summaryrefslogtreecommitdiff
path: root/src/chown-core.c
AgeCommit message (Collapse)Author
2004-07-28Include inttostr.h.Paul Eggert
(UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove. (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr instead of uint_to_string). (describe_change): Instead of an int flag, use a char * auxiliary; this avoids the need for casts. Assume free (NULL) works. (change_file_owner): Return true/false, not 0/-1, since we don't set errno. All callers changed. Use bool when appropriate. (chown_files): Likewise.
2004-06-09(change_file_owner): Change names of parametersJim Meyering
old_uid and old_gid to required_uid and required_gid respectively.
2004-06-09Adjust chmod and chown to be similar if -c or -v are given. InJim Meyering
particular, a no-op chown is no longer reported as a change; this reverts to previous behavior. Also, fix both commands so that -v report failures even if the failure is not due to the chmod or chown syscalls. * src/chown-core.c (change_file_owner): Return -1 on error, not 1 sometimes and -1 on others. Our caller ORs together our results, and (-1 | 1) == 0 on ones-complement hosts. With -v report all errors verbosely, not just some. Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent: file_stats wasn't set properly in that case.
2004-06-08(change_file_owner): Use ent->fts_statp only ifJim Meyering
needed. Chown a directory only after chowning its children; this avoids problems if the new directory ownership doesn't permit access to the children. Dereference symlinks before doing ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /. Do not optimize away the chown() system call when the file's owner and group already have the desired value. POSIX does not permit this optimization. Rely on chown and lchown to do the right thing with symlinks and/or -1 arguments, now that we have wrappers to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP errors, not just command-line errors. (chown_files): Pass FTS_STAT to xfts_open if we don't need file status.
2004-05-17(chopt_init): Affect each symlink referent by default.Jim Meyering
2004-05-16chown --dereference did nothing when the owner/group of aJim Meyering
symlink matched the desired owner/group. Reported by David Malone. Also reported in 1999 as http://bugs.debian.org/39642. (change_file_owner): When --dereference has been specified, and when processing a symlink, stat it to get the owner and group of the referent.
2004-05-01When chown or chgrp is modifying the referent of a symlink,Jim Meyering
use the chown(2) function, if possible. (change_file_owner): Don't hard-code the open/fchown/close kludge here. Use `chown' instead. The chown function works just fine on conforming systems. Other systems now go through the new chown wrapper that resorts to the old kludge.
2004-05-01(change_file_owner): Add a comment.Jim Meyering
2004-04-27(chopt_init, chopt_free, gid_to_name, uid_to_name, chown_files):Jim Meyering
Add `extern' keyword.
2004-03-27Don't include savedir.h -- no longer needed.Jim Meyering
2003-11-09Include "root-dev-ino.h".Jim Meyering
(chopt_init): Initialize new member. (change_file_owner): Support rm's new --preserve-root option.
2003-10-17(change_file_owner): Handle the cases inJim Meyering
which fts_info indicates an error with the given entry.
2003-10-17Include "xfts.h".Jim Meyering
(chown_files): Use xfts_open, rather than fts_open.
2003-10-17tweak commentJim Meyering
2003-10-15Rewrite to iterate through hierarchies using fts rather thanJim Meyering
via explicit recursion. Include "fts_.h" (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate on a single file at a time. (chown_files): New function.
2003-10-05(change_file_owner): Remove set-but-not-used local.Jim Meyering
2003-07-12(change_file_owner): Do not restore any specialJim Meyering
permission bits (e.g., set-user-ID, set-group-ID) that are reset by chown(2) on some systems. Suggestion and insistence :-) from Michael Stone.
2003-07-10(change_file_owner): Don't leak file descriptors when dereferencing symlinks.Jim Meyering
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2001-12-11(change_file_owner):Jim Meyering
Include the word `fail' in some diagnostics to make it clearer that they indicate a failure. s/getting attributes/failed to get attributes/
2001-08-31(change_dir_owner): Remove statp arg; no longer needed.Jim Meyering
2000-12-16(uint_to_string): New function.Jim Meyering
(uid_to_name): Use it. (gid_to_name): Use it. Rename locals, user/group, to uid/gid.
2000-12-15Declare lstat.Jim Meyering
Rename change_symlinks member to `dereference' and use the DEREF_* enum values. (describe_change): Merge the chgrp and chown switch statements. Use xmalloc to form the `user:group' string. (change_file_owner): Record (and later, use) is_symlink and is_directory from the lstat stats, in order to control whether we operate on symlinks and whether (with -R) we traverse symlinks to directories. When dereferencing, use open/fchown (rather than chown) on symlinks.
2000-12-10give a better diagnostic when only the group is being changedJim Meyering
2000-12-09(chopt_free): don't free anythingJim Meyering
2000-12-09Include <pwd.h>, <grp.h>, and "xalloc.h".Jim Meyering
[!_POSIX_VERSION]: Declare getgrnam and getgrgid. (gid_to_name): New function. (uid_to_name): Likewise. (chopt_free): Likewise.
2000-12-09*** empty log message ***Jim Meyering