[Tarantool-patches] [PATCH 2/2] Allow to set directory for copying DSO before load

Kirill Yukhin kyukhin at tarantool.org
Mon Jun 1 13:53:35 MSK 2020


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.


More information about the Tarantool-patches mailing list