diff options
author | Jim Meyering <jim@meyering.net> | 1998-07-09 14:29:11 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-07-09 14:29:11 +0000 |
commit | 5c7130646317b9f9500fc7d514df540277e1ec61 (patch) | |
tree | 79d0df0fd085215ce0830297b8885273415ff8c6 /m4 | |
parent | da69105424c97d2048d9f5923740f84e8b1594ee (diff) | |
download | coreutils-5c7130646317b9f9500fc7d514df540277e1ec61.tar.xz |
(jm_FUNC_CHOWN): Add a check to verify that the
uid and gid actually remain unchanged.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/chown.m4 | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/m4/chown.m4 b/m4/chown.m4 index 4ae19a953..1fb6203e9 100644 --- a/m4/chown.m4 +++ b/m4/chown.m4 @@ -17,6 +17,7 @@ AC_DEFUN(jm_FUNC_CHOWN, AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown, [AC_TRY_RUN([ # include <sys/types.h> +# include <stat.h> # include <fcntl.h> # ifdef HAVE_UNISTD_H # include <unistd.h> @@ -28,7 +29,14 @@ AC_DEFUN(jm_FUNC_CHOWN, char *f = "conftestchown"; if (creat (f, 0600) < 0) exit (1); - exit (chown (f, (uid_t) -1, (gid_t) -1) == -1 ? 1 : 0); + if (stat (f, &before) < 0) + exit (1); + if (chown (f, (uid_t) -1, (gid_t) -1) == -1) + exit (1); + if (stat (f, &after) < 0) + exit (1); + exit ((before.st_uid == after.st_uid + && before.st_gid == after.st_gid) ? 0 : 1); } ], jm_cv_func_working_chown=yes, |