From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5DE9B469710 for ; Mon, 1 Jun 2020 13:53:36 +0300 (MSK) Date: Mon, 1 Jun 2020 13:53:35 +0300 From: Kirill Yukhin Message-ID: <20200601105335.hnm4qega7vijrgys@tarantool.org> References: <17830780bc75041a478126ee3d13c96bbd5f8b04.1589968157.git.kyukhin@tarantool.org> <20200529105907.GK215590@grain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200529105907.GK215590@grain> Subject: Re: [Tarantool-patches] [PATCH 2/2] Allow to set directory for copying DSO before load List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Hello, Thanks a lot! Both objections fixed. -- Regards, Kirill Yukhin On 29 май 13:59, Cyrill Gorcunov wrote: > On Wed, May 20, 2020 at 12:51:18PM +0300, Kirill Yukhin wrote: > ... > > --- a/src/box/call.c > > +++ b/src/box/call.c > > @@ -129,10 +129,14 @@ box_module_reload(const char *name) > > return -1; > > } > > struct module *module = NULL; > > - if (module_reload(name, name + strlen(name), &module) == 0 && > > - module != NULL) > > - return 0; > > - diag_set(ClientError, ER_NO_SUCH_MODULE, name); > > + if (module_reload(name, name + strlen(name), &module) == 0) { > > + if (module != NULL) > > + return 0; > > + else { > > + diag_set(ClientError, ER_NO_SUCH_MODULE, name); > > + return -1; > > Redundant return -1? Since we're gonna return -1 a few lines lower anyway. > I might be missing something obvious but I don't get why have you moved > module != NULL into a separate block. If you prefer this form I don't > mind though. > > > + } > > + } > > return -1; > > } > > > > diff --git a/src/box/func.c b/src/box/func.c > > index a42a269..0405eb9 100644 > > --- a/src/box/func.c > > +++ b/src/box/func.c > > @@ -261,14 +261,29 @@ module_load(const char *package, const char *package_end) > > module->package[package_len] = 0; > > rlist_create(&module->funcs); > > module->calls = 0; > > - char dir_name[] = "/tmp/tntXXXXXX"; > > + > > + const char *tmpdir = getenv("TMPDIR"); > > + if (tmpdir == NULL) > > + tmpdir = "/tmp"; > > + char dir_name[PATH_MAX + 1]; > > No need for PATH_MAX + 1, PATH_MAX should be enough. Other than this -- Ack.