From 241f825d41c4af2c99b5a56388bd2fe21f1098e6 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 29 Sep 2009 13:59:35 +0100 Subject: Makefile: Don't combine variable export with assignment for compatibility with other shells (thanks Filip) --- util-src/Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'util-src') diff --git a/util-src/Makefile b/util-src/Makefile index 3b7ca7bc..fdf97c53 100644 --- a/util-src/Makefile +++ b/util-src/Makefile @@ -24,21 +24,28 @@ clean: encodings.o: encodings.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o encodings.o encodings.c encodings.so: encodings.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o encodings.so encodings.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lidn + MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o encodings.so encodings.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lidn hashes.o: hashes.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o hashes.o hashes.c hashes.so: hashes.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o hashes.so hashes.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lcrypto + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o hashes.so hashes.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lcrypto pposix.o: pposix.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o pposix.o pposix.c pposix.so: pposix.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o pposix.so pposix.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o pposix.so pposix.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) lsignal.o: lsignal.c $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o lsignal.o lsignal.c signal.so: lsignal.o - export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o signal.so lsignal.o + MACOSX_DEPLOYMENT_TARGET="10.3"; + export MACOSX_DEPLOYMENT_TARGET; + $(LD) $(LFLAGS) -o signal.so lsignal.o -- cgit v1.2.3 From 5407a9c88dc9ae485e6eb82f5482669b6556253f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 29 Sep 2009 14:06:43 +0100 Subject: util.signal: Change ifdef to allow signal.kill() on Solaris (thanks Filip) --- util-src/lsignal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/lsignal.c b/util-src/lsignal.c index 158efcd6..80799e4a 100644 --- a/util-src/lsignal.c +++ b/util-src/lsignal.c @@ -301,7 +301,7 @@ static int l_raise(lua_State *L) return 1; } -#ifdef _POSIX_SOURCE +#if defined _POSIX_SOURCE || (defined(sun) || defined(__sun)) /* define some posix only functions */ -- cgit v1.2.3 From d059f42d87dec4b77e0aad6fb1383bc95399d8c1 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 29 Sep 2009 14:22:02 +0100 Subject: util.pposix: Compatibility with Solaris systems (thanks Filip) --- util-src/pposix.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'util-src') diff --git a/util-src/pposix.c b/util-src/pposix.c index d27a84b1..265245e0 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -91,10 +91,14 @@ static int lc_daemonize(lua_State *L) const char * const facility_strings[] = { "auth", +#if !(defined(sun) || defined(__sun)) "authpriv", +#endif "cron", "daemon", +#if !(defined(sun) || defined(__sun)) "ftp", +#endif "kern", "local0", "local1", @@ -113,10 +117,14 @@ const char * const facility_strings[] = { }; int facility_constants[] = { LOG_AUTH, +#if !(defined(sun) || defined(__sun)) LOG_AUTHPRIV, +#endif LOG_CRON, LOG_DAEMON, +#if !(defined(sun) || defined(__sun)) LOG_FTP, +#endif LOG_KERN, LOG_LOCAL0, LOG_LOCAL1, @@ -365,11 +373,13 @@ int string2resource(const char *s) { if (!strcmp(s, "CPU")) return RLIMIT_CPU; if (!strcmp(s, "DATA")) return RLIMIT_DATA; if (!strcmp(s, "FSIZE")) return RLIMIT_FSIZE; - if (!strcmp(s, "MEMLOCK")) return RLIMIT_MEMLOCK; if (!strcmp(s, "NOFILE")) return RLIMIT_NOFILE; + if (!strcmp(s, "STACK")) return RLIMIT_STACK; +#if !(defined(sun) || defined(__sun)) + if (!strcmp(s, "MEMLOCK")) return RLIMIT_MEMLOCK; if (!strcmp(s, "NPROC")) return RLIMIT_NPROC; if (!strcmp(s, "RSS")) return RLIMIT_RSS; - if (!strcmp(s, "STACK")) return RLIMIT_STACK; +#endif return -1; } -- cgit v1.2.3 From e094c8b08b002896c440c3b55785bcf119007c91 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 29 Sep 2009 19:05:32 +0100 Subject: util.encodings: Don't throw an error but return nil when passed nil or a non-string value --- util-src/encodings.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/encodings.c b/util-src/encodings.c index 65d7d501..bee4365c 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -124,8 +124,12 @@ static const luaL_Reg Reg_base64[] = static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) { + if(!lua_isstring(L, 1)) { + lua_pushnil(L); + return 1; + } size_t len; - const char *s = luaL_checklstring(L, 1, &len); + const char *s = lua_tolstring(L, 1, &len); char string[1024]; int ret; if (len >= 1024) { -- cgit v1.2.3