summaryrefslogtreecommitdiff
path: root/src/chmod.c
AgeCommit message (Collapse)Author
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-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-09-03Don't include dirname.h, since system.h does it now.Paul Eggert
2006-07-17(process_file): Adjust to mode_adjust API change.Paul Eggert
2006-05-20(main): Use FTS_PHYSICAL here, too.Jim Meyering
2006-04-17(describe_change): Adjust to filemode changes.Paul Eggert
2006-01-17Now that fts no longer changes the current working directory, adjustJim Meyering
its clients accordingly -- note that du.c uses fts but doesn't need any adjustment, since it doesn't operate on the actual files, but rather just uses the stat buffers provided by fts. Include "openat.h". (process_file): Use chmodat (fts->fts_cwd_fd,... in place of chmod (...
2005-06-29(main): Use X2REALLOC rather than x2realloc.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-04Include quotearg.h.Paul Eggert
(diagnose_surprises): New var. (process_file): Diagnose surprises. Simplify the logic a bit, while we're at it. (main): Prepare to diagnose surprises. Remove useless code for '-' option.
2005-04-28(change, umask_value): New static vars.Paul Eggert
(reference_file): Move this static var to inside "main". (process_file, process_files): Remove CHANGES arg; now taken from static var. All uses changed. (usage): Fix incorrect description of MODE operand. (main): For invalid mode usages, output a brief usage message. Adjust to new modechange API.
2005-03-28(long_options): Use NULL, not `0'.Jim Meyering
2004-09-24(main): Revamp option processing to support "chmod -r -w file".Paul Eggert
2004-09-21Remove unused "case 0".Paul Eggert
2004-07-30(recurse, force_silent, process_file, process_files, main): Use boolPaul Eggert
when appropriate.
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-06-09(mode_changed): Return false, not 0, now that the function returns `bool'.Jim Meyering
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/chmod.c (CH_NOT_APPLIED): New constant. (describe_change): Handle it. (process_file): Use it, if a symlink wasn't changed. (mode_changed): Return bool, not int. Accept new argument NEW_MODE; all callers changed. This lets us avoid statting the file unless the new mode has unusual bits. (process_file): Return -1 on error. With -v, report all errors verbosely, not just some.
2004-03-27Don't include savedir.h -- no longer needed.Jim Meyering
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
2003-11-09(usage): Describe new options.Jim Meyering
2003-11-09Include "root-dev-ino.h".Jim Meyering
(process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and ROOT_DEV_INO_WARN macros. (get_root_dev_ino): Remove function definition, now that it's been moved to a separate file.
2003-11-04(AUTHORS): Add my name.Jim Meyering
2003-10-19chmod now uses fts to perform a directory traversal when -R isJim Meyering
specified. Before, it operated on full path names, and as such would encounter the PATH_MAX (often 4096) limit. Include "xfts.h". (process_file): Rename from change_file_mode. Adapt to be used with fts. (process_files): New function.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-10-12New options: --preserve-root and --no-preserve-root.Jim Meyering
(change_file_mode): Honor new option. (change_file_mode): Strip trailing slashes on directory argument passed to change_dir_mode. (get_root_dev_ino): New function. (main): Initialize global, root_dev_ino.
2003-10-12(change_file_mode): Don't #ifdef-out a simple use ofJim Meyering
S_ISLNK. The S_IS* macros are guaranteed to be defined via system.h.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-06-17(main): Call initialize_main.Jim Meyering
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-08-30Change `error (1, ...' to `error (EXIT_FAILURE, ...'.Jim Meyering
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2001-12-11split long lineJim Meyering
2001-12-11(change_file_mode, main):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-12-02Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-23Split usage strings so that --help and --versionJim Meyering
descriptions are alone in their own string.
2001-11-23(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-09-15(main): Don't strip trailing slashes; POSIX doesn't allow it here.Jim Meyering
Don't include "dirname.h" when no longer needed.
2001-08-31(change_dir_mode): Remove statp arg; no longer needed.Jim Meyering
2001-05-12(strip_trailing_slashes): Remove declaration; now in dirname.h.Jim Meyering
2001-05-12(mode_changed, change_file_mode):Jim Meyering
There's no need to invoke both lstat and stat here, so call just one of the two functions.
2000-11-23(mode_changed): New function.Jim Meyering
(change_file_mode): Use it to determine accurately when -c should make chmod announce there's been a change.
2000-11-01(main): Better diagnostics.Jim Meyering
2000-09-30(change_file_mode): Perform the chmod even if theJim Meyering
file mode permission bits are the same as those that should be set. Omitting the chmod call would be alright with minimal 1003.1e DS17 ACLs, but eventually there will be other permissions in addition to rwx. E.g., add and delete for directories, and something analogous to NT's take ownership permission.
2000-08-08(main): Invoke xalloc_die instead of printing our own message.Jim Meyering
2000-07-30Convert "`%s'" in format strings to "%s", and wrap eachJim Meyering
corresponding argument in a `quote (...)' call. Add more precise diagnostics.