Paul Eggert [Tue, 14 Jun 2005 23:56:49 +0000 (23:56 +0000)]
(make_dir): Remove. All uses replaced by mkdir.
(make_dir_parents): Last arg is now int * (for errno), not bool *.
Rewrite "mkdir -p" algorithm to avoid the need for "stat"
each time through the loop. Do not diagnose restore_cwd failure;
that is the caller's job (and perhaps the caller does not care).
Paul Eggert [Tue, 14 Jun 2005 23:55:47 +0000 (23:55 +0000)]
(create_parents): Remove static var (now local to 'main').
(main): Standardize on a diagnostic for restore_cwd failure,
and report errno.
Don't bother to check cwd_errno unless create_parents.
Use mkdir rather than make_dir; it's simpler.
Paul Eggert [Tue, 14 Jun 2005 23:55:24 +0000 (23:55 +0000)]
(main): Standardize on a diagnostic for
restore_cwd failure, and report errno.
(install_file_in_file_parents): Fail if restore_cwd fails and
one of the files is relative. This fixes a bug (albeit unlikely).
Paul Eggert [Tue, 14 Jun 2005 18:35:38 +0000 (18:35 +0000)]
(CLEANUP_CWD, CLEANUP): Remove.
(make_dir_parents): Revamp to avoid need for CLEANUP_CWD, CLEANUP.
If the file already exists but is not a directory, don't bother
to try to make its parents.
Close potential file descriptor leak if we can't chdir("/") (!).
Don't always return true if chdir($PWD) fails; return true only
if the requested action was done successfully (except for the
chdir($PWD)).
Don't log final directory unless we actually made it.
Refactor to avoid duplicate code to fix up permissions.
Don't attempt to fix up parent permissions if chdir($PWD) fails.
Jim Meyering [Tue, 14 Jun 2005 06:54:39 +0000 (06:54 +0000)]
Provide an alternative to exiting immediately upon save_cwd or
restore_cwd failure. Now, an application can arrange e.g.,
to perform a longjump in that case.
* openat.c: Include dirname.h.
Use IS_ABSOLUTE_FILE_NAME rather than testing for leading slash.
(rpl_openat, fdopendir, fstatat): Call openat_save_die
and openat_restore_die rather than calling error directly.
Don't include "error.h" or "exitfail.h"; they're no longer needed.
* openat-die.c (openat_save_die, openat_restore_die): New file.
* openat.h (openat_save_die, openat_restore_die): Declare and define.
Jim Meyering [Mon, 13 Jun 2005 10:19:18 +0000 (10:19 +0000)]
(main): When make_dir_parents changes the current working
directory, give a diagnostic about each subsequent failure to create
a dot-relative directory.
(install_file_in_file_parents): Update make_dir_parents caller.
Jim Meyering [Mon, 13 Jun 2005 10:17:36 +0000 (10:17 +0000)]
(main): When make_dir_parents changes the current working
directory, give a diagnostic about each subsequent failure to create
a dot-relative directory.
Jim Meyering [Mon, 13 Jun 2005 10:15:19 +0000 (10:15 +0000)]
(make_dir_parents): New parameter: different_working_dir,
to tell caller if/when we change the working directory and are
unable to return to the initial one.
Paul Eggert [Fri, 10 Jun 2005 19:31:45 +0000 (19:31 +0000)]
(any_has_acl): New var.
(clear_files): Clear it.
(gobble_file): Set it if a file has an ACL.
(print_long_format): Omit needless space unless some file has an ACL.
Paul Eggert [Thu, 2 Jun 2005 05:15:07 +0000 (05:15 +0000)]
Don't use "path" or "filename".
(struct file_name): Renamed from struct Path. All uses changed.
(file_name_free): Renamed from path_free. All uses changed.
(file_name_init): Renamed from path_init. All uses changed.
(file_name_prepend): Renamed from path_prepend. All uses changed.
Paul Eggert [Thu, 2 Jun 2005 05:12:17 +0000 (05:12 +0000)]
Don't use "path" or "filename".
(usage): Don't use "path" to describe a file name.
(remove_empty_parents): Renamed from empty_paths.
All uses changed.
(longopts): Add comment that --path is deprecated.
Paul Eggert [Thu, 2 Jun 2005 05:11:01 +0000 (05:11 +0000)]
Don't use "path" or "filename".
(parents_option): Renamed from flag_path. All uses changed.
(make_dir_parents_private): Renamed from make_path_private.
All uses changed.
(usage): Don't use "path" to describe a file name.
Paul Eggert [Thu, 2 Jun 2005 05:06:56 +0000 (05:06 +0000)]
Use "file name" when talking about file names, instead of "filename"
or "path", as per the GNU coding standards. As part of this,
rename makepath.c to mkdir-p.c, and path-concat.c to filenamecat.c,
and likewise for the .h files.
Paul Eggert [Thu, 2 Jun 2005 04:59:51 +0000 (04:59 +0000)]
Renamed from path-concat.m4.
(gl_FILE_NAME_CONCAT): Renamed from gl_PATH_CONCAT. All uses changed.
Rename files from path-concat.c to filenamecat.c,
and from path-concat.h to filenamecat.h.
Paul Eggert [Thu, 2 Jun 2005 04:57:31 +0000 (04:57 +0000)]
Renamed from makepath.m4.
(gl_MKDIR_PARENTS): Renamed from gl_MAKEPATH. All uses changed.
Rename files from makepath.c to mkdir-p.c, and from
makepath.h to mkdir-p.h.
Jim Meyering [Tue, 31 May 2005 07:06:23 +0000 (07:06 +0000)]
(chown_privileges, chown_failure_ok): Mark as `extern'.
This is a crutch so that `make distcheck's sc_tight_scope rule
knows that they really are deliberately declared that way.
Paul Eggert [Tue, 31 May 2005 06:15:48 +0000 (06:15 +0000)]
(re_protect): Remove unnecessary call to geteuid.
Use chown_failure_ok rather than our own code.
(cp_options_init): Use chown_privileges rather than getuid.
Paul Eggert [Tue, 31 May 2005 06:14:24 +0000 (06:14 +0000)]
Port to Solaris 10's rules for whether programs can chown files.
[HAVE_PRIV_H]: Include <priv.h>.
(DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
changed.
(copy_internal): If chown failed, don't worry about what happened
to the mode bits; they can't have changed.
(chown_privileges, chown_failure_ok): New functions.
Paul Eggert [Mon, 30 May 2005 07:34:23 +0000 (07:34 +0000)]
Include sys/param.h if it exists, not if _POSIX_VERSION
isn't defined.
Don't include <sys/file.h>; no longer needed.
(getegid, geteuid): Remove no-longer-necessary decls.