Age | Commit message (Collapse) | Author |
|
unistd.h, string.h, chdir-safer.h, dirname.h, lchmod.h, lchown.h,
save-cwd.h. Instead, include dirchownmod.h and mkancesdirs.h.
(make_dir_parents): New args MAKE_ANCESTOR, OPTIONS, ANNOUNCE,
MODE_BITS. Remove options VERBOSE_FMT_STRING, CWD_ERRNO. All
callers changed. Revamp internals significantly, by not
attempting to create directories that are temporarily more
permissive than the final results. Do not attempt to use
save_cwd/restore_cwd; it isn't worth it for mkdir and install.
This removes some race conditions, fixes some bugs, and simplifies
things. Use new dirchownmod function to do owner and mode changes.
|
|
(make_dir_parents): Use lchown rather than chown, and
lchmod rather than chmod.
|
|
if we've just created the directory.
|
|
(make_dir_parents): Use S_IRWXU, now that read access is also required.
Avoid a race condition, on systems where open honors O_NOFOLLOW.
(make_dir_parents): Include chdir-safer.h.
Use chdir_no_follow in place of chdir.
|
|
since now it's guaranteed to be (void *).
|
|
on mkdir failing with a particular errno value (EEXIST).
Based on a patch by Dmitry V. Levin.
|
|
more robust, e.g., when the final component is created as a non-
directory by another process just before `mkdir -p's final mkdir.
|
|
directory but exit nonzero with a diagnostic. This could also be
triggered with a non-`.' component, e.g., in a race with another
process running the same `mkdir -p nonexistent/sub' command.
(make_dir_parents): Handle the case of an existing final component.
Reported by Matthias Andree here:
http://savannah.gnu.org/bugs/?func=detailitem&item_id=14848
|
|
intermediate directory is in a read-only file system.
|
|
(make_dir_parents): Treat ENOSYS like EEXIST.
|
|
|
|
Use the variable name instead.
|
|
stop us from restricting permissions of just-created absolute-named
directories.
|
|
(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).
|
|
(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.
|
|
|
|
to restore initial working directory.
|
|
to tell caller if/when we change the working directory and are
unable to return to the initial one.
|
|
This fixes a bug introduced on 2004-07-30.
|
|
(make_dir_parents): Renamed from make_path. All callers changed.
|