Mercurial > hg > octave-kai > gnulib-hg
changeset 895:ed06e76b0452
.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Thu, 13 Mar 1997 05:16:47 +0000 |
parents | f8d6bd5bd125 |
children | 43c2fe6f45d5 |
files | lib/Makefile.in lib/chown.c |
diffstat | 2 files changed, 28 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -49,7 +49,7 @@ noinst_LIBRARIES = libfu.a -EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c +EXTRA_DIST = chown.c mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c INCLUDES = -I.. -I$(srcdir) -I../intl @@ -92,13 +92,13 @@ LINK = $(CC) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) -DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c error.c \ -error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \ -getdate.c getgroups.c getline.c group-member.c interlock memcmp.c \ -memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h \ -posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stpcpy.c \ -strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c strtoul.c \ -ylwrap +DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c chown.c \ +error.c error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c \ +ftruncate.c getdate.c getgroups.c getline.c group-member.c interlock \ +memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c \ +obstack.h posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c \ +rx.h stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c \ +strtol.c strtoul.c ylwrap PACKAGE = @PACKAGE@ @@ -109,15 +109,15 @@ TAR = tar DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \ -.deps/basename.P .deps/dirname.P .deps/error.P .deps/euidaccess.P \ -.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \ -.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \ -.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \ -.deps/group-member.P .deps/idcache.P .deps/isdir.P .deps/long-options.P \ -.deps/makepath.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \ -.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \ -.deps/obstack.P .deps/path-concat.P .deps/posixtm.P .deps/regex.P \ -.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \ +.deps/basename.P .deps/chown.P .deps/dirname.P .deps/error.P \ +.deps/euidaccess.P .deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P \ +.deps/fsusage.P .deps/ftruncate.P .deps/full-write.P .deps/getdate.P \ +.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \ +.deps/getversion.P .deps/group-member.P .deps/idcache.P .deps/isdir.P \ +.deps/long-options.P .deps/makepath.P .deps/memcmp.P .deps/memcpy.P \ +.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \ +.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \ +.deps/regex.P .deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \ .deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stpcpy.P \ .deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \ .deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
--- a/lib/chown.c +++ b/lib/chown.c @@ -34,8 +34,17 @@ { if (gid == (gid_t) -1 || uid == (uid_t) -1) { - /* Stat file to get id(s) that will remain unchanged. */ - FIXME + struct stat file_stats; + + /* Stat file to get id(s) that should remain unchanged. */ + if (stat (file, &file_stats)) + return 1; + + if (gid == (gid_t) -1) + gid = file_stats.st_gid; + + if (uid == (uid_t) -1) + uid = file_stats.st_uid; } #undef chown