RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: lua/local/ lposix.c rpm/ CHANGES configure.ac rpm/rpmio/ ma...

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Mon 10 Nov 2008 - 21:26:55 CET
Message-ID: <20081110202655.GA96558@engelschall.com>
On Sun, Nov 09, 2008, Jeff Johnson wrote:

>     - jbj: lua: bind mkdtemp(3) in lposix.c
>     - jbj: macros: add %{mkdtemp:...} primitive (consistent leading whitespace too).
> [...]
>   Index: lua/local/lposix.c
>   ============================================================================
>   $ cvs diff -u -r1.10 -r1.11 lposix.c
>   --- lua/local/lposix.c	27 Oct 2008 23:57:34 -0000	1.10
>   +++ lua/local/lposix.c	9 Nov 2008 16:12:36 -0000	1.11
>   @@ -538,6 +538,24 @@
>    	return pushresult(L, mkdir(path, 0777), path);
>    }
>
>   +static int Pmkdtemp(lua_State *L)		/** mkdtemp(template) */
>   +	/*@globals fileSystem @*/
>   +	/*@modifies L, fileSystem @*/
>   +{
>   +	const char *template = luaL_checkstring(L, 1);
>   +	const char *path;
>   +	char buf[MYBUFSIZ];
>   +	(void) strncpy(buf, template, sizeof(buf));
>   +	buf[sizeof(buf)-1] = '\0';
>   +	if ((path = mkdtemp(buf)) == NULL)
>   +		return pusherror(L, template);
>   +	else
>   +	{
>   +		lua_pushstring(L, path);
>   +		return 1;
>   +	}
>   +}
>   +

In rpmio/macro.c you are using HAVE_MKDTEMP for portability reasons, but
here in lposix.c you are not using it. This let's lposix.c to break on
some platforms as mkdtemp(3) is a BSD/Linux thing. It for instance is
not available under Solaris...

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Received on Mon Nov 10 21:30:08 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.