summaryrefslogtreecommitdiff
path: root/src/chown-core.c
AgeCommit message (Collapse)Author
2015-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-02-20maint: cleanup up various uses of __attribute__Pádraig Brady
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute() form without trailing underscores as that is not elided where required. Also ensure we use gnulib macros rather than defining our own. * src/system.h: Remove gnulib provided macros. * src/chown-core.c: Likewise. * src/chroot.c: Likewise. * src/copy.c: Likewise. * src/csplit.c: Likewise. * src/dd.c: Likewise. * src/expr.c: Likewise. * src/extent-scan.c: Likewise. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/ptx.c: Likewise. * src/sort.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/system.h: Likewise. * src/tac.c: Likewise. * src/test.c: Likewise. * src/tsort.c: Likewise.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-01-27maint: use single copyright year rangeJim Meyering
Run "make update-copyright".
2012-01-09maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering
Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-06-04maint: remove now-spurious curly bracesJim Meyering
* src/chown-core.c (restricted_chown): Remove FIXME comment and superfluous curly braces.
2011-05-27chown,chgrp: output the original ownership in -v messagesPádraig Brady
* src/chown-core.c (describe_change): Output the original owner if possible. (user_group_str): Handle the case when neither owner or group are passed. * NEWS: Mention the change in behavior.
2011-05-27chown,chgrp: output the correct ownership in -v messagesPádraig Brady
* src/chown_core.c (describe_change): Accept the ownership of the original file and output that when not changing. This is significant when --from is specified as then the original and specified ownership may be different. (user_group_str): A new helper function refactored from describe_change(). (change_file_owner): Pass the original user and group strings to describe_change(). * test/chown/basic: Add a test case. * NEWS: Mention the fix.
2011-01-07maint: replace uses of ignore_ptr with ignore_valuePádraig Brady
* gnulib: Update for enhanced ignore_value() * src/chcon.c (process_file): Don't use the deprecated ignore_ptr. * src/chmod.c (process_file): Likewise. * src/chown-core.c (change_file_owner): Likewise.
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-07-09chcon, chmod, chown, du: don't translate "%s"Paul Eggert
* src/chcon.c (process_file): Replace _("%s") with "%s". * src/chmod.c (process_file): Likewise. * src/chown-core.c (change_file_owner): Likewise. * src/du.c (process_file): Likewise.
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-11-07chcon, chgrp, chmod and chown now diagnose a directory cycleJim Meyering
* lib/xfts.c (cycle_warning_required): New function. * lib/xfts.h: Declare it. * src/chown-core.c (change_file_owner): Diagnose a cycle. * src/chmod.c (process_file): Likewise. * src/chcon.c (process_file): Likewise. * NEWS (Bug fixes): Mention this.
2009-09-23maint: Use logical rather than bitwise operators on boolsPádraig Brady
This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1)
2009-09-01chcon, chmod, chgrp, chown, du: report fts_close failurePádraig Brady
* src/du.c (du_files): Don't fail silently upon fts_close failure. * src/chcon.c (process_files): Likewise. * src/chmod.c (process_files): Likewise. * src/chown-core.c (chown_files): Likewise.
2009-09-01chcon, chmod, chgrp, chown, du: do not ignore fts_close failureJim Meyering
This is probably never visible, but who knows... * src/chcon.c (process_files): Don't ignore fts_close failure. * src/chmod.c (process_files): Likewise. * src/chown-core.c (chown_files): Likewise. * src/du.c (du_files): Likewise.
2009-09-01maint: chown, chgrp, chmod, chcon: remove unnecessary initializationJim Meyering
* src/chown-core.c: Include "ignore-value.h". (change_file_owner): Don't set "ent" only to ignore it. * src/chcon.c (process_file): Likewise. * src/chmod.c: Include "ignore-value.h". (process_file): Don't set "ent" only to ignore it. After diagnosing root-dev/ino failure, return false immediately: Now that we don't set "ent" we must be sure not to use it uninitialized, and there's no point in issuing --verbose-related output in this case.
2009-08-25global: convert indentation-TABs to spacesJim Meyering
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-06-23maint: update all Copyright year lists to include 2009Jim Meyering
2009-04-07maint: Clarify ambiguous refs to Linux kernels or GNU/Linux systemsPádraig Brady
* README-prereq: s_linux_GNU/Linux_ or s_linux_Linux kernel_ * README-valgrind: ditto * src/chown-core.c: ditto * src/dd.c: ditto * src/df.c: ditto * src/ls.c: ditto * src/mv.c: ditto * src/pwd.c: ditto * src/remove.c: ditto * src/shred.c: ditto * src/stat.c: ditto * src/su.c: ditto * src/system.h: ditto * src/timeout.c: ditto * src/truncate.c: ditto
2008-12-03chmod, chown, chgrp: honor --silent (-f) once againOndřej Vašík
* chmod.c (process_file): Make -f suppress fts-related diagnostics. * chown-core.c (change_file_owner): Likewise. Reported via <http://bugzilla.redhat.com/474220>.
2008-06-27factor out time_t-to-string conversion idiomJim Meyering
* src/system.h: Include "inttostr.h". (timetostr): New function, factored out of... * src/date.c (show_date): Use timetostr. * src/du.c (show_date): Likewise. * src/ls.c (print_long_format): Likewise. * src/pinky.c (time_string): Likewise. * src/stat.c (human_time): Likewise. * src/*.c: Don't include inttostr.h, since system.h does. * src/c99-to-c89.diff: Adjust offsets.
2008-02-28Make copyright comments consistent.Jim Meyering
* src/mktemp.c: Update copyright to use newer form. Make first copyright lines consistent. Some did not end in ", Inc.". Due to that missing ", Inc" at end of line, emacs' copyright-updating code missed some opportunities. This corrects most of those, and adds some mistakenly omitted years. * src/chown-core.c: Adjust. * src/chown-core.h: Likewise. * src/copy.c: Likewise. * src/copy.h: Likewise. * src/cp-hash.c: Likewise. * src/cp.c: Likewise. * src/group-list.h: Likewise. * src/mktemp.c: Likewise. * src/stat.c: Likewise. * tests/chmod/equal-x: Likewise. * tests/dd/skip-seek: Likewise. * tests/envvar-check: Likewise. * tests/mv/into-self-2: Likewise.
2008-01-30Now that system.h defines is_empty_dir, include "openat.h".Jim Meyering
* src/system.h: Include "openat.h" here, ... * src/chcon.c: ... not here. * src/chmod.c: Likewise. * src/chown-core.c: Likewise. * src/remove.c: Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-01-10Don't use fts_statp uninitialized for "chown -RLh --preserve-root ...".Jim Meyering
* src/chown-core.c (FTSENT_IS_DIRECTORY): New macro. (change_file_owner): Perform the ROOT_DEV_INO_CHECK only for a directory. Non-directory entries lack fts_statp data when using the FTS_NOSTAT option.
2006-12-14chgrp, chown: Don't prohibit -RLh, aka -RL with --no-dereference.Jim Meyering
* src/chgrp.c (main): Don't prohibit -RLh, aka -RL with --no-dereference. * src/chown.c (main): Likewise. * src/chown-core.c (change_file_owner): Add to a comment. * tests/chown/preserve-root: Add tests. * doc/coreutils.texi (Treating / specially): With --preserve-root, chgrp and chown will not modify "/", even through a symlink.
2006-12-14* NEWS: --preserve-root now works with chgrp, chmod, and chown.Jim Meyering
* src/chmod.c (process_file): Do honor the --preserve-root option. * src/chown-core.c (change_file_owner): Likewise, but here, also handle the case in which a traversal would go "through" a symlink to root. Reported by Matthew M. Boedicker * tests/chown/preserve-root: Test for the above. * tests/chown/Makefile.am (TESTS): Add preserve-root.
2006-10-20Enable an fts optimization (call lstat only for directories,Jim Meyering
on some file system types) also with the --preserve-root option of chown or chgrp. * src/chown-core.c (change_file_owner): Compare fts_statp-based dev/ino against root dev/ino only for directories. (chown_files): Don't let the root_dev_ino setting influence whether we use FTS_NOSTAT: fts always sets *fts_statp for a directory.
2006-10-13More chown/chgrp dereferencing-related fixes.Jim Meyering
* src/chown-core.c (change_file_owner): Don't use fts_statp if we're dereferencing symlinks. Reverse conjuncts, so that we use dereference file_stats (aka ent->fts_statp) only *after* we've confirmed that chopt->affect_symlink_referent is true. Otherwise, we might use ent->fts_statp uninitialized. Don't turn on FTS_NOSTAT when dereferencing symlinks. * tests/chown/deref: Update the expected diagnostic, now that this test case (trying to use "chown --dereference ..." on a dangling symlink) takes a different code path.
2006-10-13* src/chown-core.c (change_file_owner): Use fstatat, not stat,Jim Meyering
now that we're using fts_open with FTS_CWDFD. * tests/chgrp/posix-H: Add --preserve-root to an invocation of chgrp, to exercise the above fix.
2006-09-20Fix the 2006-09-18 bug differently.Jim Meyering
* src/chmod.c: (process_file): Upon FTS_NS for a top-level file, tell fts_read to stat the file again, in case it has become accessible since the initial fts_open call. * src/chown-core.c (change_file_owner): Likewise.
2006-09-20* src/chmod.c: Revert last change. There is a better way.Jim Meyering
* src/chown-core.c: Likewise.
2006-09-18Fix bug where chmod, chown, and chgrp did not process operandsPaul Eggert
left-to-right in some cases. * src/chmod.c (wd_errno): New var. (chmod_file): New function, with most of the contents of the old prcess_file function. (process_files): Use it. This gives file names to fts one at a time, so that they are processed left-to-right as POSIX requires. * src/chown-core.c (wd_errno, chown_files): Likewise. (chown_file): New function. * tests/install/basic-1: Redo test so as to not workaround the chmod bug, thereby testing for it.
2006-01-17Include "openat.h".Jim Meyering
Don't include "lchown.h". (restricted_chown): Accept a new parameter, CWD_FD, and use it in calling openat, lchownat, chownat, rather than open, lchown, chown. Update caller.
2006-01-03(RC_do_ordinary_chown): New enum value.Paul Eggert
(restricted_chown): Return it, if the file cannot be accessed due to EPERM, or if no uid or gid are required, or if the file is neither a directory nor a regular file. Rewrite to avoid gotos. (change_file_owner): Handle RC_do_ordinary_chown case. Rewrite to avoid gotos.
2005-12-27(restricted_chown):Paul Eggert
Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
2005-05-30(getgrnam, getgrgid) [!defined _POSIX_VERSION]:Paul Eggert
Remove decls.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-14Correct typo, fchmod -> fchown, in a comment.Jim Meyering
2005-04-10(chopt_free): Mark parameter as unused.Jim Meyering
2005-03-28(chopt_init): Use NULL, not `0'.Jim Meyering
2005-02-21(enum RCH_status): Remove trailing comma,Paul Eggert
as it's not valid in standard C89.
2004-12-11Avoid a race condition vulnerability in chown, when used withJim Meyering
--from=O:G and without the (-h) --no-dereference option. (restricted_chown): New function. (change_file_owner): Call it. Reported by Ulrich Drepper.
2004-09-22(chown_files): Declare as `extern'.Jim Meyering
2004-08-19(describe_change): Describe changes to -1:-1Paul Eggert
without using "to OWNERSHIP" phrase.