Age | Commit message (Collapse) | Author |
|
|
|
|
|
(make_dir_parents): Use lchown rather than chown, and
lchmod rather than chmod.
|
|
|
|
for write access: POSIX says that must fail.
|
|
Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
Fall back on chown if open failed with EACCES.
|
|
Include stat-macros.h.
Include stdlib.h, for abort().
Don't include stdio.h or assert.h; no longer needed.
(same_file_type): Don't assume S_IFMT is defined, as POSIX
does not require this. Don't assume S_IFCHR and S_IFBLK have
their usual sort of bit pattern.
(fchmod_new): Open with O_NOCTTY for as well, for minor
improvement on hosts where that matters. Don't bother to assert,
since the caller (in this source file) checks the same thing.
Discard any errno from a close failure, for consistency with other
code.
|
|
POSIX says that must fail.
|
|
access: POSIX says that must fail.
|
|
for write access: POSIX says that must fail.
(cdb_free): Open with O_NOCTTY | O_NONBLOCK as
well, for minor improvements on hosts that lack O_DIRECTORY.
|
|
sb2, `down' into the scope where it is used.
Note that on some systems this function also fails when DIR
is a writable-yet-unreadable directory.
|
|
|
|
|
|
|
|
|
|
unistd.h, fcntl--.h; not needed.
(O_DIRECTORY): Define if not already defined.
(chdir_no_follow): Revamp describing comment to match code more
closely. Redo use of internal vars to avoid lint complaints.
Work even if directory is writeable but not readable.
Open with O_DIRECTORY | O_NOCTTY, for benefit of hosts that
don't have O_NOFOLLOW. Use O_NONBLOCK (POSIX spelling) rather
than O_NDELAY. Don't bother invoking fstat if open does not
dereference symlink, since the result isn't used then.
Don't assume file descriptor is positive; it might be zero
now that we no longer include fcntl--.h (we don't need fcntl--.h
since we immediately close the descriptor).
|
|
|
|
|
|
|
|
|
|
if we've just created the directory.
|
|
|
|
|
|
when O_NOFOLLOW is not defined. Suggested by Eric Blake.
|
|
|
|
|
|
|
|
|
|
and dup to open_safer and dup_safer, respectively.
(openat_permissive): Fix typo in comment.
|
|
|
|
|
|
|
|
|
|
|
|
(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 *).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
systems other than Linux.
(chmod_or_fchmod): New function: use fchmod when possible,
and chmod otherwise.
(file_has_acl): Add a POSIX ACL implementation, with a
Linux-specific subcase.
(copy_acl): Add: copy an acl and S_ISUID, S_ISGID, and
S_ISVTX from one file to another. Fall back to fchmod/chmod when
acls are unsupported.
(set_acl): Add: set a file's acl and S_ISUID, S_ISGID, and
S_ISVTX to a defined value. Fall back to fchmod/chmod when acls
are unsupported.
|
|
|
|
|
|
"gettext.h"; either no longer needed or are guaranteed by openat.h.
(_): Remove; no longer needed.
(openat): Renamed from rpl_openat; no need for rpl_openat
since openat.h renames openat for us.
Replace most of the body with a call to openat_permissive,
to avoid duplicate code.
Port to (probably hypothetical) environments were mode_t is
wider than int.
(openat_permissive): Require mode arg, so that we can check
types better. Put it just after flags. Change cwd failure
indicator from pointer-to-bool to pointer-to-errno-value.
All callers changed.
Invoke openat_save_fail and/or openat_restore_fail if
cwd_errno is null, so that openat can call us.
(openat_permissive, fdopendir, fstatat, unlinkat):
Simplify errno handling to avoid some duplicate code,
as it's OK to set errno on success.
|
|
__OPENAT_PREFIX only, not also on AT_FDCWD.
(openat_ro): Remove. Caller changed to use openat_permissive.
(openat_permissive): Now a macro, if not a function.
(openat_restore_fail, openat_save_fail): Now always functions,
since mkdirat needs them even if __OPENAT_PREFIX is defined.
|
|
|
|
|