X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fuserspec.c;h=67f1583335c513b3043a01a83e5484bdf6644f6c;hb=d33ed582fc804afef36639a9fbcf8a3e242dc7b7;hp=c7045324549b415d57642370758bbbe6792a8b4d;hpb=26a0ec5ba4c1399b08249a830626c1296896bdcd;p=gnulib.git diff --git a/lib/userspec.c b/lib/userspec.c index c70453245..67f158333 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -18,17 +18,22 @@ /* Written by David MacKenzie . */ #ifdef HAVE_CONFIG_H -#if defined (CONFIG_BROKETS) -/* We use instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ #include +#endif + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else +#ifdef HAVE_ALLOCA_H +#include #else -#include "config.h" +#ifdef _AIX + #pragma alloca +#else +char *alloca (); +#endif #endif #endif - -/* FIXME: include alloca junk. */ #include #include @@ -116,7 +121,6 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg) char *spec; /* A copy we can write on. */ struct passwd *pwd; struct group *grp; - int spec_len; char *g, *u, *separator; char *groupname; @@ -124,10 +128,7 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg) *username_arg = *groupname_arg = NULL; groupname = NULL; - /* FIXME: use this instead: V_STRDUP (spec, spec_arg); */ - spec_len = strlen (spec_arg); - spec = (char *) alloca (strlen (spec_arg) + 1); - strcpy (spec, spec_arg); + V_STRDUP (spec, spec_arg); /* Find the separator if there is one. */ separator = index (spec, ':'); @@ -241,7 +242,7 @@ parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg) return error_msg; } -#ifdef TESTING +#ifdef TEST #define NULL_CHECK(s) ((s) == NULL ? "(null)" : (s))