]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Sync from gnulib.
authorJim Meyering <jim@meyering.net>
Sun, 4 Apr 2004 06:51:11 +0000 (06:51 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 4 Apr 2004 06:51:11 +0000 (06:51 +0000)
21 files changed:
lib/ChangeLog
lib/Makefile.in
lib/cloexec.c
lib/cloexec.h
lib/file-type.c
lib/file-type.h
lib/getloadavg.c
lib/getndelim2.c
lib/getusershell.c
lib/group-member.c
lib/human.c
lib/path-concat.c
lib/printf-args.c
lib/printf-args.h
lib/quotearg.c
lib/quotearg.h
lib/setenv.c
lib/strdup.c
lib/userspec.c
lib/userspec.h
lib/vasprintf.c

index b36278b30908c197cbe1fac188f7fb62e30c8154..a92f5df9e2b8a6e75cbeefa4981cea2214a2be42 100644 (file)
@@ -2,9 +2,9 @@
 
        * cloexec.c, cloexec.h, config.charset, file-type.c, file-type.h:
        * getloadavg.c, getndelim2.c, getusershell.c, group-member.c:
-       * human.c, path-concat.c, printf-args.c, printf-args.h, quotearg.c:
-       * quotearg.h, setenv.c, strdup.c, userspec.c:
-       * userspec.h, vasprintf.c: Sync from gnulib.
+       * human.c, path-concat.c, printf-args.c, printf-args.h:
+       * quotearg.c, quotearg.h, setenv.c, strdup.c:
+       * userspec.c, userspec.h, vasprintf.c: Sync from gnulib.
 
        * allocsa.c, allocsa.h, strdup.h: New files, from gnulib.
        * Makefile.am (libfetish_a_SOURCES): Add allocsa.c, allocsa.h,
index 1462ece271a1289e611c362c9b2397f5317dfdab..0b82c1dc452ac52ea23531923464198de2b246c4 100644 (file)
@@ -58,17 +58,18 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        tempname.c utime.c vasnprintf.c vasprintf.c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \
-       $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/assert.m4 \
-       $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/backupfile.m4 \
-       $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/boottime.m4 \
-       $(top_srcdir)/m4/canon-host.m4 \
+       $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \
+       $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/atexit.m4 \
+       $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
+       $(top_srcdir)/m4/boottime.m4 $(top_srcdir)/m4/canon-host.m4 \
        $(top_srcdir)/m4/canonicalize.m4 \
        $(top_srcdir)/m4/check-decl.m4 $(top_srcdir)/m4/chown.m4 \
-       $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/closeout.m4 \
-       $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/d-ino.m4 \
-       $(top_srcdir)/m4/d-type.m4 $(top_srcdir)/m4/dirfd.m4 \
-       $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dos.m4 \
-       $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/error.m4 \
+       $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/cloexec.m4 \
+       $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \
+       $(top_srcdir)/m4/d-ino.m4 $(top_srcdir)/m4/d-type.m4 \
+       $(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/dirname.m4 \
+       $(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/dup2.m4 \
+       $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/error.m4 \
        $(top_srcdir)/m4/euidaccess.m4 $(top_srcdir)/m4/exclude.m4 \
        $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
        $(top_srcdir)/m4/file-type.m4 $(top_srcdir)/m4/fileblocks.m4 \
@@ -88,57 +89,58 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \
        $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hash.m4 \
        $(top_srcdir)/m4/host-os.m4 $(top_srcdir)/m4/human.m4 \
        $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/idcache.m4 \
-       $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
-       $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
-       $(top_srcdir)/m4/jm-macros.m4 $(top_srcdir)/m4/jm-winsz1.m4 \
-       $(top_srcdir)/m4/jm-winsz2.m4 $(top_srcdir)/m4/lchown.m4 \
-       $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/link-follow.m4 \
+       $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttostr.m4 \
+       $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \
+       $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/jm-macros.m4 \
+       $(top_srcdir)/m4/jm-winsz1.m4 $(top_srcdir)/m4/jm-winsz2.m4 \
+       $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/lib-check.m4 \
+       $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+       $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/link-follow.m4 \
        $(top_srcdir)/m4/long-options.m4 \
        $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
        $(top_srcdir)/m4/ls-mntd-fs.m4 $(top_srcdir)/m4/lstat.m4 \
        $(top_srcdir)/m4/makepath.m4 $(top_srcdir)/m4/mbrtowc.m4 \
-       $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/md5.m4 \
-       $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/memcmp.m4 \
-       $(top_srcdir)/m4/memcoll.m4 $(top_srcdir)/m4/memcpy.m4 \
-       $(top_srcdir)/m4/memmove.m4 $(top_srcdir)/m4/memrchr.m4 \
-       $(top_srcdir)/m4/memset.m4 $(top_srcdir)/m4/mkdir-slash.m4 \
-       $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/mktime.m4 \
-       $(top_srcdir)/m4/modechange.m4 $(top_srcdir)/m4/mountlist.m4 \
-       $(top_srcdir)/m4/nanosleep.m4 $(top_srcdir)/m4/nls.m4 \
-       $(top_srcdir)/m4/obstack.m4 $(top_srcdir)/m4/onceonly.m4 \
-       $(top_srcdir)/m4/path-concat.m4 $(top_srcdir)/m4/pathmax.m4 \
-       $(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/physmem.m4 \
-       $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posixtm.m4 \
-       $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \
-       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \
-       $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
-       $(top_srcdir)/m4/readdir.m4 $(top_srcdir)/m4/readlink.m4 \
-       $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \
-       $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rename.m4 \
-       $(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/rmdir-errno.m4 \
-       $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/rpmatch.m4 \
-       $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
-       $(top_srcdir)/m4/same.m4 $(top_srcdir)/m4/save-cwd.m4 \
-       $(top_srcdir)/m4/savedir.m4 $(top_srcdir)/m4/settime.m4 \
-       $(top_srcdir)/m4/sha.m4 $(top_srcdir)/m4/sig2str.m4 \
-       $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/st_mtim.m4 \
-       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdbool.m4 \
-       $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio-safer.m4 \
-       $(top_srcdir)/m4/stpcpy.m4 $(top_srcdir)/m4/strcase.m4 \
-       $(top_srcdir)/m4/strcspn.m4 $(top_srcdir)/m4/strdup.m4 \
-       $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/strndup.m4 \
-       $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/strpbrk.m4 \
-       $(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/strtod.m4 \
-       $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtol.m4 \
-       $(top_srcdir)/m4/strtoll.m4 $(top_srcdir)/m4/strtoul.m4 \
-       $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \
-       $(top_srcdir)/m4/strverscmp.m4 $(top_srcdir)/m4/timespec.m4 \
-       $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/tzset.m4 \
-       $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
-       $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
+       $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbswidth.m4 \
+       $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/memchr.m4 \
+       $(top_srcdir)/m4/memcmp.m4 $(top_srcdir)/m4/memcoll.m4 \
+       $(top_srcdir)/m4/memcpy.m4 $(top_srcdir)/m4/memmove.m4 \
+       $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/memset.m4 \
+       $(top_srcdir)/m4/mkdir-slash.m4 $(top_srcdir)/m4/mkstemp.m4 \
+       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/modechange.m4 \
+       $(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nanosleep.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/obstack.m4 \
+       $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/path-concat.m4 \
+       $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perl.m4 \
+       $(top_srcdir)/m4/physmem.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/posixtm.m4 $(top_srcdir)/m4/posixver.m4 \
+       $(top_srcdir)/m4/prereq.m4 $(top_srcdir)/m4/progtest.m4 \
+       $(top_srcdir)/m4/putenv.m4 $(top_srcdir)/m4/quote.m4 \
+       $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/readdir.m4 \
+       $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readtokens.m4 \
+       $(top_srcdir)/m4/readutmp.m4 $(top_srcdir)/m4/regex.m4 \
+       $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/restrict.m4 \
+       $(top_srcdir)/m4/rmdir-errno.m4 $(top_srcdir)/m4/rmdir.m4 \
+       $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \
+       $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \
+       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \
+       $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha.m4 \
+       $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/signed.m4 \
+       $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \
+       $(top_srcdir)/m4/st_mtim.m4 $(top_srcdir)/m4/stat.m4 \
+       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h.m4 \
+       $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
+       $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strcspn.m4 \
+       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \
+       $(top_srcdir)/m4/strndup.m4 $(top_srcdir)/m4/strnlen.m4 \
+       $(top_srcdir)/m4/strpbrk.m4 $(top_srcdir)/m4/strstr.m4 \
+       $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/strtoimax.m4 \
+       $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoll.m4 \
+       $(top_srcdir)/m4/strtoul.m4 $(top_srcdir)/m4/strtoull.m4 \
+       $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/strverscmp.m4 \
+       $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
+       $(top_srcdir)/m4/tzset.m4 $(top_srcdir)/m4/uintmax_t.m4 \
+       $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unicodeio.m4 \
+       $(top_srcdir)/m4/unistd-safer.m4 \
        $(top_srcdir)/m4/unlink-busy.m4 \
        $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \
        $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \
@@ -165,16 +167,16 @@ am__DEPENDENCIES_2 = @ALLOCA@
 am_libfetish_a_OBJECTS = acl.$(OBJEXT) getdate.$(OBJEXT) \
        posixtm.$(OBJEXT) posixver.$(OBJEXT) strftime.$(OBJEXT) \
        getopt.$(OBJEXT) getopt1.$(OBJEXT) hash.$(OBJEXT) \
-       hash-pjw.$(OBJEXT) addext.$(OBJEXT) argmatch.$(OBJEXT) \
-       backupfile.$(OBJEXT) basename.$(OBJEXT) c-strtod.$(OBJEXT) \
-       canon-host.$(OBJEXT) cloexec.$(OBJEXT) closeout.$(OBJEXT) \
-       cycle-check.$(OBJEXT) diacrit.$(OBJEXT) dirname.$(OBJEXT) \
-       dup-safer.$(OBJEXT) exclude.$(OBJEXT) exitfail.$(OBJEXT) \
-       filemode.$(OBJEXT) file-type.$(OBJEXT) fopen-safer.$(OBJEXT) \
-       fts.$(OBJEXT) full-read.$(OBJEXT) full-write.$(OBJEXT) \
-       gettime.$(OBJEXT) getugroups.$(OBJEXT) hard-locale.$(OBJEXT) \
-       human.$(OBJEXT) idcache.$(OBJEXT) isdir.$(OBJEXT) \
-       imaxtostr.$(OBJEXT) linebuffer.$(OBJEXT) \
+       hash-pjw.$(OBJEXT) addext.$(OBJEXT) allocsa.$(OBJEXT) \
+       argmatch.$(OBJEXT) backupfile.$(OBJEXT) basename.$(OBJEXT) \
+       c-strtod.$(OBJEXT) canon-host.$(OBJEXT) cloexec.$(OBJEXT) \
+       closeout.$(OBJEXT) cycle-check.$(OBJEXT) diacrit.$(OBJEXT) \
+       dirname.$(OBJEXT) dup-safer.$(OBJEXT) exclude.$(OBJEXT) \
+       exitfail.$(OBJEXT) filemode.$(OBJEXT) file-type.$(OBJEXT) \
+       fopen-safer.$(OBJEXT) fts.$(OBJEXT) full-read.$(OBJEXT) \
+       full-write.$(OBJEXT) gettime.$(OBJEXT) getugroups.$(OBJEXT) \
+       hard-locale.$(OBJEXT) human.$(OBJEXT) idcache.$(OBJEXT) \
+       isdir.$(OBJEXT) imaxtostr.$(OBJEXT) linebuffer.$(OBJEXT) \
        localcharset.$(OBJEXT) long-options.$(OBJEXT) \
        makepath.$(OBJEXT) mbswidth.$(OBJEXT) md5.$(OBJEXT) \
        memcasecmp.$(OBJEXT) memcoll.$(OBJEXT) modechange.$(OBJEXT) \
@@ -235,18 +237,19 @@ am__depfiles_maybe = depfiles
 @AMDEP_TRUE@   $(DEPDIR)/tempname.Po $(DEPDIR)/utime.Po \
 @AMDEP_TRUE@   $(DEPDIR)/vasnprintf.Po $(DEPDIR)/vasprintf.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/acl.Po ./$(DEPDIR)/addext.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/argmatch.Po ./$(DEPDIR)/backupfile.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/basename.Po ./$(DEPDIR)/c-strtod.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/canon-host.Po ./$(DEPDIR)/cloexec.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/closeout.Po ./$(DEPDIR)/cycle-check.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/diacrit.Po ./$(DEPDIR)/dirname.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/dup-safer.Po ./$(DEPDIR)/exclude.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/exitfail.Po ./$(DEPDIR)/file-type.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/filemode.Po ./$(DEPDIR)/fopen-safer.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/fts.Po ./$(DEPDIR)/full-read.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/full-write.Po ./$(DEPDIR)/getdate.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/gettime.Po ./$(DEPDIR)/getugroups.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/allocsa.Po ./$(DEPDIR)/argmatch.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/backupfile.Po ./$(DEPDIR)/basename.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/c-strtod.Po ./$(DEPDIR)/canon-host.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/cloexec.Po ./$(DEPDIR)/closeout.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/cycle-check.Po ./$(DEPDIR)/diacrit.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/dirname.Po ./$(DEPDIR)/dup-safer.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/exclude.Po ./$(DEPDIR)/exitfail.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/file-type.Po ./$(DEPDIR)/filemode.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/fopen-safer.Po ./$(DEPDIR)/fts.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/full-read.Po ./$(DEPDIR)/full-write.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/getdate.Po ./$(DEPDIR)/getopt.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/getopt1.Po ./$(DEPDIR)/gettime.Po \
+@AMDEP_TRUE@   ./$(DEPDIR)/getugroups.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/hard-locale.Po ./$(DEPDIR)/hash-pjw.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/hash.Po ./$(DEPDIR)/human.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/idcache.Po ./$(DEPDIR)/imaxtostr.Po \
@@ -417,6 +420,7 @@ libfetish_a_SOURCES = \
   hash-pjw.c hash-pjw.h \
   __fpending.h \
   addext.c \
+  allocsa.c allocsa.h \
   argmatch.c argmatch.h \
   backupfile.c backupfile.h \
   basename.c \
@@ -485,6 +489,7 @@ libfetish_a_SOURCES = \
   sig2str.h \
   stdio-safer.h \
   stripslash.c \
+  strdup.h \
   strndup.h \
   strverscmp.h \
   time_r.c time_r.h \
@@ -504,7 +509,7 @@ libfetish_a_SOURCES = \
   xmemcoll.c xmemcoll.h \
   xnanosleep.c xnanosleep.h \
   xreadlink.c xreadlink.h \
-  xstrdup.c \
+  xstrdup.c  \
   xstrndup.c xstrndup.h \
   xstrtod.c xstrtod.h \
   xstrtoimax.c \
@@ -659,6 +664,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocsa.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backupfile.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
index 20f30db45d868321f6d7c8a3728b9030e3ff37ac..e07cdd3d5daf3001da6017c8625f44364cc8b907 100644 (file)
 
 /* Set the `FD_CLOEXEC' flag of DESC if VALUE is true,
    or clear the flag if VALUE is false.
-   Return true on success, or false on error with `errno' set. */
+   Return 0 on success, or -1 on error with `errno' set. */
 
-bool
+int
 set_cloexec_flag (int desc, bool value)
 {
 #if defined F_GETFD && defined F_SETFD
 
   int flags = fcntl (desc, F_GETFD, 0);
-  int newflags;
 
-  if (flags < 0)
-    return false;
+  if (0 <= flags)
+    {
+      int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
 
-  newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
+      if (flags == newflags
+         || fcntl (desc, F_SETFD, newflags) != -1)
+       return 0;
+    }
 
-  return (flags == newflags
-         || fcntl (desc, F_SETFD, newflags) != -1);
+  return -1;
 
 #else
 
-  return true;
+  return 0;
 
 #endif
 }
index ecad8d712f739626eb9cf1c405c34400c5053ede..c25921d6b375567d668f6a88c156ad2ce30c18d6 100644 (file)
@@ -1,2 +1,2 @@
 #include <stdbool.h>
-bool set_cloexec_flag (int desc, bool value);
+int set_cloexec_flag (int desc, bool value);
index 87919a5911e83b38a019a0fbfa8a2cb991b279f9..3c58c7fb06603e43f6f8c3707362fe7ecc59d5f4 100644 (file)
@@ -1,6 +1,6 @@
 /* Return a string describing the type of a file.
 
-   Copyright (C) 1993, 1994, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 2001, 2002, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -68,5 +68,8 @@ file_type (struct stat const *st)
   if (S_TYPEISSHM (st))
     return _("shared memory object");
 
+  if (S_TYPEISTMO (st))
+    return _("typed memory object");
+
   return _("weird file");
 }
index c766d6c21a21e9f8dbd01f810532daf31e3bcbfa..502f091635dcc55df710a8b57ff1e76cf7093afb 100644 (file)
@@ -1,6 +1,6 @@
 /* Return a string describing the type of a file.
 
-   Copyright (C) 1993, 1994, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 2001, 2002, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -138,6 +138,15 @@ char const *file_type (struct stat const *);
 # endif
 
 
+# ifndef S_TYPEISMQ
+#  define S_TYPEISMQ(p) 0
+# endif
+
+# ifndef S_TYPEISTMO
+#  define S_TYPEISTMO(p) 0
+# endif
+
+
 # ifndef S_TYPEISSEM
 #  ifdef S_INSEM
 #   define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
@@ -154,8 +163,4 @@ char const *file_type (struct stat const *);
 #  endif
 # endif
 
-# ifndef S_TYPEISMQ
-#  define S_TYPEISMQ(p) 0
-# endif
-
 #endif /* FILE_TYPE_H */
index dce4117f087623eae5651f3393cb8c9bf5b5e869..ed079b2ec243f20b13ff380c7f23136b90c5e09a 100644 (file)
@@ -606,7 +606,9 @@ getloadavg (double loadavg[], int nelem)
     return -1;
 
   /* The following sscanf must use the C locale.  */
-  old_locale = xstrdup (setlocale (LC_NUMERIC, NULL));
+  old_locale = setlocale (LC_NUMERIC, NULL);
+  if (old_locale)
+    old_locale = xstrdup (old_locale);
   setlocale (LC_NUMERIC, "C");
   count = sscanf (ldavgbuf, "%lf %lf %lf",
                  &load_ave[0], &load_ave[1], &load_ave[2]);
index 6f0868999525c671560ad97759abc0dec2de4cff..3959462593d33460b35b072dcaca161d21c7d2e2 100644 (file)
@@ -81,18 +81,15 @@ getndelim2 (char **lineptr, size_t *linesize, size_t nmax,
          size_t newlinesize =
            (*linesize > MIN_CHUNK ? 2 * *linesize : *linesize + MIN_CHUNK);
 
-         if (newlinesize > nmax)
+         if (! (*linesize < newlinesize && newlinesize <= nmax))
            newlinesize = nmax;
 
-         if (newlinesize > *linesize)
-           {
-             *linesize = newlinesize;
-             nbytes_avail = *linesize + *lineptr - read_pos;
-             *lineptr = realloc (*lineptr, *linesize);
-             if (!*lineptr)
-               return -1;
-             read_pos = *linesize - nbytes_avail + *lineptr;
-           }
+         *linesize = newlinesize;
+         nbytes_avail = *linesize + *lineptr - read_pos;
+         *lineptr = realloc (*lineptr, *linesize);
+         if (!*lineptr)
+           return -1;
+         read_pos = *linesize - nbytes_avail + *lineptr;
        }
 
       c = getc (stream);
index c026ec0a9c2482b8bf077c97b0f55028fb200d34..9b60f18d5b60b02bdc55ec16bd2a83a82c2b78ac 100644 (file)
@@ -145,29 +145,17 @@ readname (char **name, size_t *size, FILE *stream)
   int c;
   size_t name_index = 0;
 
-  if (*name == NULL)
-    {
-      /* The initial size must be a power of two, so that the overflow
-        check works.  */
-      *size = 16;
-
-      *name = xmalloc (*size);
-    }
-
   /* Skip blank space.  */
   while ((c = getc (stream)) != EOF && ISSPACE (c))
     /* Do nothing. */ ;
 
-  while (c != EOF && !ISSPACE (c))
+  for (;;)
     {
+      if (*size <= name_index)
+       *name = x2nrealloc (*name, size, sizeof **name);
+      if (c == EOF || ISSPACE (c))
+       break;
       (*name)[name_index++] = c;
-      if (*size < name_index)
-       {
-         *size *= 2;
-         if (! *size)
-           xalloc_die ();
-         *name = xrealloc (*name, *size);
-       }
       c = getc (stream);
     }
   (*name)[name_index] = '\0';
index 8823506b0f722b26c09e3cd508c5eb43d2a68bac..9ba49a85394df5fadd1e24c70984e1a3b4b2ca8c 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "group-member.h"
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h>
@@ -40,47 +41,38 @@ struct group_info
 #if HAVE_GETGROUPS
 
 static void
-free_group_info (struct group_info *g)
+free_group_info (struct group_info const *g)
 {
   free (g->group);
-  free (g);
 }
 
-static struct group_info *
-get_group_info (void)
+static bool
+get_group_info (struct group_info *gi)
 {
   int n_groups;
-  int n_group_slots;
-  struct group_info *gi;
+  int n_group_slots = getgroups (0, NULL);
   GETGROUPS_T *group;
 
-  /* getgroups () returns the number of elements that it was able to
-     place into the array.  We simply continue to call getgroups ()
-     until the number of elements placed into the array is smaller than
-     the physical size of the array. */
+  if (n_group_slots < 0)
+    return false;
 
-  group = NULL;
-  n_groups = 0;
-  n_group_slots = 0;
-  while (n_groups == n_group_slots)
-    {
-      n_group_slots += 64;
-      group = xrealloc (group, n_group_slots * sizeof (GETGROUPS_T));
-      n_groups = getgroups (n_group_slots, group);
-    }
+  /* Avoid xnmalloc, as it goes awry when SIZE_MAX < n_group_slots.  */
+  if (xalloc_oversized (n_group_slots, sizeof *group))
+    xalloc_die ();
+  group = xmalloc (n_group_slots * sizeof *group);
+  n_groups = getgroups (n_group_slots, group);
 
   /* In case of error, the user loses. */
   if (n_groups < 0)
     {
       free (group);
-      return NULL;
+      return false;
     }
 
-  gi = xmalloc (sizeof (*gi));
   gi->n_groups = n_groups;
   gi->group = group;
 
-  return gi;
+  return true;
 }
 
 #endif /* not HAVE_GETGROUPS */
@@ -97,24 +89,23 @@ group_member (gid_t gid)
 #else
   int i;
   int found;
-  struct group_info *gi;
+  struct group_info gi;
 
-  gi = get_group_info ();
-  if (gi == NULL)
+  if (! get_group_info (&gi))
     return 0;
 
   /* Search through the list looking for GID. */
   found = 0;
-  for (i = 0; i < gi->n_groups; i++)
+  for (i = 0; i < gi.n_groups; i++)
     {
-      if (gid == gi->group[i])
+      if (gid == gi.group[i])
        {
          found = 1;
          break;
        }
     }
 
-  free_group_info (gi);
+  free_group_info (&gi);
 
   return found;
 #endif /* HAVE_GETGROUPS */
index 806292707813518c33264f555540457c41936166..dbf536b1efdd630c151934c2ecd4ca2dda49428f 100644 (file)
@@ -1,7 +1,7 @@
 /* human.c -- print human readable file size
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
-   Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 7f3bc5a494bf59deaf144c8a0550191bb84b1812..db96debad6dc1028e84de12707acd26582a8ae70 100644 (file)
@@ -1,6 +1,6 @@
 /* path-concat.c -- concatenate two arbitrary pathnames
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,9 @@
 # include <config.h>
 #endif
 
+/* Specification.  */
+#include "path-concat.h"
+
 #ifndef HAVE_MEMPCPY
 # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
 #endif
 # include <unistd.h>
 #endif
 
-#ifndef strdup
-char *strdup ();
-#endif
-
+#include "strdup.h"
 #include "dirname.h"
 #include "xalloc.h"
-#include "path-concat.h"
 
 /* Concatenate two pathname components, DIR and BASE, in
    newly-allocated storage and return the result.  Return 0 if out of
index 6972cfd42ec3887c4d321f985f919625ddb98957..926ae8ffe7e8a58e1172ea525917bbff5f427228 100644 (file)
@@ -28,7 +28,7 @@ STATIC
 int
 printf_fetchargs (va_list args, arguments *a)
 {
-  unsigned int i;
+  size_t i;
   argument *ap;
 
   for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
index c938192b7add9868eadc30877c5cab2dfa96fb89..4b75c723f31e2d9ed3cbea65a9370b79dbdb0d26 100644 (file)
@@ -18,6 +18,9 @@
 #ifndef _PRINTF_ARGS_H
 #define _PRINTF_ARGS_H
 
+/* Get size_t.  */
+#include <stddef.h>
+
 /* Get wchar_t.  */
 #ifdef HAVE_WCHAR_T
 # include <stddef.h>
@@ -116,7 +119,7 @@ argument;
 
 typedef struct
 {
-  unsigned int count;
+  size_t count;
   argument *arg;
 }
 arguments;
index c695646f13ec247187b0404c04835f6f0479976e..fe747fb0b91e6e97ecb3b19e720146938a60e8b8 100644 (file)
@@ -1,5 +1,7 @@
 /* quotearg.c - quote arguments for output
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -174,7 +176,7 @@ gettext_quote (char const *msgid, enum quoting_style s)
    size of the output, not counting the terminating null.
    If BUFFERSIZE is too small to store the output string, return the
    value that would have been returned had BUFFERSIZE been large enough.
-   If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
+   If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.
 
    This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
    ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting
@@ -326,6 +328,10 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
            }
          break;
 
+       case '{': case '}': /* sometimes special if isolated */
+         if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
+           break;
+         /* Fall through.  */
        case '#': case '~':
          if (i != 0)
            break;
@@ -334,7 +340,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
        case '!': /* special in bash */
        case '"': case '$': case '&':
        case '(': case ')': case '*': case ';':
-       case '<': case '>': case '[':
+       case '<':
+       case '=': /* sometimes special in 0th or (with "set -k") later args */
+       case '>': case '[':
        case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
        case '`': case '|':
          /* A shell special character.  In theory, '$' and '`' could
@@ -364,7 +372,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
 
        case '%': case '+': case ',': case '-': case '.': case '/':
        case '0': case '1': case '2': case '3': case '4': case '5':
-       case '6': case '7': case '8': case '9': case ':': case '=':
+       case '6': case '7': case '8': case '9': case ':':
        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
        case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
        case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
@@ -374,7 +382,6 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
        case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
        case 'o': case 'p': case 'q': case 'r': case 's': case 't':
        case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
-       case '{': case '}':
          /* These characters don't cause problems, no matter what the
             quoting style is.  They cannot start multibyte sequences.  */
          break;
@@ -427,6 +434,22 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
                      }
                    else
                      {
+                       /* Work around a bug with older shells that "see" a '\'
+                          that is really the 2nd byte of a multibyte character.
+                          In practice the problem is limited to ASCII
+                          chars >= '@' that are shell special chars.  */
+                       if ('[' == 0x5b && quoting_style == shell_quoting_style)
+                         {
+                           size_t j;
+                           for (j = 1; j < bytes; j++)
+                             switch (arg[i + m + j])
+                               {
+                               case '[': case '\\': case '^':
+                               case '`': case '|':
+                                 goto use_shell_always_quoting_style;
+                               }
+                         }
+                           
                        if (! iswprint (w))
                          printable = 0;
                        m += bytes;
@@ -472,6 +495,9 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
       STORE (c);
     }
 
+  if (i == 0 && quoting_style == shell_quoting_style)
+    goto use_shell_always_quoting_style;
+
   if (quote_string)
     for (; *quote_string; quote_string++)
       STORE (*quote_string);
@@ -492,7 +518,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
    size of the output, not counting the terminating null.
    If BUFFERSIZE is too small to store the output string, return the
    value that would have been returned had BUFFERSIZE been large enough.
-   If ARGSIZE is -1, use the string length of the argument for ARGSIZE.  */
+   If ARGSIZE is SIZE_MAX, use the string length of the argument for
+   ARGSIZE.  */
 size_t
 quotearg_buffer (char *buffer, size_t buffersize,
                 char const *arg, size_t argsize,
@@ -506,8 +533,23 @@ quotearg_buffer (char *buffer, size_t buffersize,
   return r;
 }
 
+/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly
+   allocated storage containing the quoted string.  */
+char *
+quotearg_alloc (char const *arg, size_t argsize,
+               struct quoting_options const *o)
+{
+  int e = errno;
+  size_t bufsize = quotearg_buffer (0, 0, arg, argsize, o) + 1;
+  char *buf = xmalloc (bufsize);
+  quotearg_buffer (buf, bufsize, arg, argsize, o);
+  errno = e;
+  return buf;
+}
+
 /* Use storage slot N to return a quoted version of argument ARG.
-   ARG is of size ARGSIZE, but if that is -1, ARG is a null-terminated string.
+   ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a
+   null-terminated string.
    OPTIONS specifies the quoting options.
    The returned value points to static storage that can be
    reused by the next call to this function with the same value of N.
index efc933173dcb3674d1a88d1ac2314d77ef187b97..2bbf38d92a14d74ea5248ba66480cfc2bf6d1354 100644 (file)
@@ -1,6 +1,6 @@
 /* quotearg.h - quote arguments for output
 
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
 /* Basic quoting styles.  */
 enum quoting_style
   {
-    literal_quoting_style,     /* --quoting-style=literal */
-    shell_quoting_style,       /* --quoting-style=shell */
-    shell_always_quoting_style,        /* --quoting-style=shell-always */
-    c_quoting_style,           /* --quoting-style=c */
-    escape_quoting_style,      /* --quoting-style=escape */
-    locale_quoting_style,      /* --quoting-style=locale */
-    clocale_quoting_style      /* --quoting-style=clocale */
+    /* Output names as-is (ls --quoting-style=literal).  */
+    literal_quoting_style,
+    
+    /* Quote names for the shell if they contain shell metacharacters
+       or would cause ambiguous output (ls --quoting-style=shell).  */
+    shell_quoting_style,
+
+    /* Quote names for the shell, even if they would normally not
+       require quoting (ls --quoting-style=shell-always).  */
+    shell_always_quoting_style,
+
+    /* Quote names as for a C language string (ls --quoting-style=c).  */
+    c_quoting_style,
+
+    /* Like c_quoting_style except omit the surrounding double-quote
+       characters (ls --quoting-style=escape).  */
+    escape_quoting_style,
+
+    /* Like clocale_quoting_style, but quote `like this' instead of
+       "like this" in the default C locale (ls --quoting-style=locale).  */
+    locale_quoting_style,
+
+    /* Like c_quoting_style except use quotation marks appropriate for
+       the locale (ls --quoting-style=clocale).  */
+    clocale_quoting_style
   };
 
 /* For now, --quoting-style=literal is the default, but this may change.  */
@@ -81,6 +99,11 @@ size_t quotearg_buffer (char *buffer, size_t buffersize,
                        char const *arg, size_t argsize,
                        struct quoting_options const *o);
 
+/* Like quotearg_buffer, except return the result in a newly allocated
+   buffer.  It is the caller's responsibility to free the result.  */
+char *quotearg_alloc (char const *arg, size_t argsize,
+                     struct quoting_options const *o);
+
 /* Use storage slot N to return a quoted version of the string ARG.
    Use the default quoting options.
    The returned value points to static storage that can be
index f185e04db0d58ea48be6cc22d695e4b8b1fdd74f..c3f9dc4ca4495c75803fda6de49581c335310bfd 100644 (file)
@@ -34,13 +34,8 @@ extern int errno;
 # include <unistd.h>
 #endif
 
-/* For those losing systems which don't have 'alloca' we have to add
-   some additional code emulating it.  */
-#if _LIBC || HAVE_ALLOCA
-# define freea(p) /* nothing */
-#else
-# define alloca(n) malloc (n)
-# define freea(p) free (p)
+#if !_LIBC
+# include "allocsa.h"
 #endif
 
 #if !_LIBC
@@ -163,11 +158,18 @@ __add_to_environ (const char *name, const char *value, const char *combined,
        {
          /* See whether the value is already known.  */
 #ifdef USE_TSEARCH
-         new_value = (char *) alloca (namelen + 1 + vallen);
 # ifdef _LIBC
+         new_value = (char *) alloca (namelen + 1 + vallen);
          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
                     value, vallen);
 # else
+         new_value = (char *) allocsa (namelen + 1 + vallen);
+         if (new_value == NULL)
+           {
+             __set_errno (ENOMEM);
+             UNLOCK;
+             return -1;
+           }
          memcpy (new_value, name, namelen);
          new_value[namelen] = '=';
          memcpy (&new_value[namelen + 1], value, vallen);
@@ -180,8 +182,8 @@ __add_to_environ (const char *name, const char *value, const char *combined,
              new_environ[size] = (char *) malloc (namelen + 1 + vallen);
              if (new_environ[size] == NULL)
                {
-#ifdef USE_TSEARCH
-                 freea (new_value);
+#if defined USE_TSEARCH && !defined _LIBC
+                 freesa (new_value);
 #endif
                  __set_errno (ENOMEM);
                  UNLOCK;
@@ -200,8 +202,8 @@ __add_to_environ (const char *name, const char *value, const char *combined,
                 user string or not.  */
              STORE_VALUE (new_environ[size]);
            }
-#ifdef USE_TSEARCH
-         freea (new_value);
+#if defined USE_TSEARCH && !defined _LIBC
+         freesa (new_value);
 #endif
        }
 
@@ -223,11 +225,19 @@ __add_to_environ (const char *name, const char *value, const char *combined,
       else
        {
 #ifdef USE_TSEARCH
-         char *new_value = alloca (namelen + 1 + vallen);
+         char *new_value;
 # ifdef _LIBC
+         new_value = alloca (namelen + 1 + vallen);
          __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
                     value, vallen);
 # else
+         new_value = allocsa (namelen + 1 + vallen);
+         if (new_value == NULL)
+           {
+             __set_errno (ENOMEM);
+             UNLOCK;
+             return -1;
+           }
          memcpy (new_value, name, namelen);
          new_value[namelen] = '=';
          memcpy (&new_value[namelen + 1], value, vallen);
@@ -240,9 +250,10 @@ __add_to_environ (const char *name, const char *value, const char *combined,
              np = malloc (namelen + 1 + vallen);
              if (np == NULL)
                {
-#ifdef USE_TSEARCH
-                 freea (new_value);
+#if defined USE_TSEARCH && !defined _LIBC
+                 freesa (new_value);
 #endif
+                 __set_errno (ENOMEM);
                  UNLOCK;
                  return -1;
                }
@@ -257,8 +268,8 @@ __add_to_environ (const char *name, const char *value, const char *combined,
              /* And remember the value.  */
              STORE_VALUE (np);
            }
-#ifdef USE_TSEARCH
-         freea (new_value);
+#if defined USE_TSEARCH && !defined _LIBC
+         freesa (new_value);
 #endif
        }
 
index 52667e98e001aea22384567e1fd1ccbc3ce51ad1..8c88e310a5bf8722480ad2eb66e9d7ed6efbcb5a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003 Free Software
+/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004 Free Software
    Foundation, Inc.
 
    This file is part of the GNU C Library.
 # include <config.h>
 #endif
 
+#ifndef _LIBC
+/* Get specification.  */
+# include "strdup.h"
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
index 474fb60628cd110c072cf770c7c248c35356727a..a997c6ff4b35040a9690014db07f705df39806a6 100644 (file)
@@ -22,6 +22,9 @@
 # include <config.h>
 #endif
 
+/* Specification.  */
+#include "userspec.h"
+
 #include <alloca.h>
 
 #include <stdio.h>
@@ -41,7 +44,7 @@
 # include <unistd.h>
 #endif
 
-#include "userspec.h"
+#include "strdup.h"
 #include "xalloc.h"
 #include "xstrtol.h"
 
@@ -108,10 +111,6 @@ struct group *getgrgid ();
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
 
-#ifndef strdup
-char *strdup ();
-#endif
-
 /* Return nonzero if STR represents an unsigned decimal integer,
    otherwise return 0. */
 
index 8f01d64d30eea4bbef04dc23f93c508e9334381f..8a09eaea0c912d9d80e7f92d534727c5c4c5da9b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef USERSPEC_H
 # define USERSPEC_H 1
 
-# include <stddef.h>
+# include <sys/types.h>
 
 const char *
 parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
index 7c8f212d724d9f5da378a921f174b1c5460487d4..bda9aa1b0f2bd812dd2477359fb08effc67dd334 100644 (file)
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -22,6 +22,9 @@
 /* Specification.  */
 #include "vasprintf.h"
 
+#include <limits.h>
+#include <stdlib.h>
+
 #include "vasnprintf.h"
 
 int
@@ -31,6 +34,14 @@ vasprintf (char **resultp, const char *format, va_list args)
   char *result = vasnprintf (NULL, &length, format, args);
   if (result == NULL)
     return -1;
+  if (length > INT_MAX)
+    {
+      /* We could produce such a big string, but can't return its length
+        as an 'int'.  */
+      free (result);
+      return -1;
+    }
+
   *resultp = result;
   /* Return the number of resulting bytes, excluding the trailing NUL.  */
   return length;