Commit Graph
22504 Commits
Author SHA1 Message Date
Jim Meyering b6c621211b Include "fcntl--.h" and "unistd--.h", to map open
and dup to open_safer and dup_safer, respectively.
(openat_permissive): Fix typo in comment.
2005-12-22 14:34:20 +00:00
Jim Meyering 1e1938032b . 2005-12-21 10:23:51 +00:00
Jim Meyering 3114855498 *** empty log message *** 2005-12-21 10:21:20 +00:00
Jim Meyering 9eb2e69d62 Require gl_CHDIR_SAFER. 2005-12-21 10:21:04 +00:00
Jim Meyering 05eb4556c8 . 2005-12-21 09:48:41 +00:00
Jim Meyering a7c7b483f1 *** empty log message *** 2005-12-21 09:43:44 +00:00
Jim Meyering 2956eb272c like chdir(2), but safer, if possible 2005-12-21 09:42:36 +00:00
Jim Meyering 3108671902 *** empty log message *** 2005-12-20 14:23:25 +00:00
Jim Meyering d0344cfc55 (RW_USR): Remove definition.
(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.
2005-12-20 14:23:20 +00:00
Jim Meyering 0b7757fac4 *** empty log message *** 2005-12-20 10:28:58 +00:00
Jim Meyering cf02d3c6f6 (make_dir_parents): Remove unnecessary casts of alloca,
since now it's guaranteed to be (void *).
2005-12-20 10:28:53 +00:00
Jim Meyering ddb24aa9fb *** empty log message *** 2005-12-20 10:24:43 +00:00
Jim Meyering 7be64dd68f (fchmod_new): Don't try to close fd if it's < 0. 2005-12-20 10:24:37 +00:00
Jim Meyering 07d7677196 . 2005-12-19 18:21:11 +00:00
Jim Meyering 3d49eb721b . 2005-12-19 18:19:38 +00:00
Jim Meyering a8b913cfdd (TESTS): Add mknod. 2005-12-19 18:18:57 +00:00
Jim Meyering fa6cfcb9ce (main) Avoid a minor race condition when `-m MODE' is specified, by using
open, fchown, and close rather than just chown.  To do that reliably
(even with an overly restrictive umask), ensure that each
mknod call uses a mode including at least owner-read access.

(main): When `-m MODE' is specified, exit nonzero if
the subsequent chown (or equivalent open,fchown,close) fails.
2005-12-19 18:18:03 +00:00
Jim Meyering 52893ffd2a (main) Avoid a minor race condition when `-m MODE' is specified, by using
open, fchown, and close rather than just chown.  To do that reliably
(even with an overly restrictive umask), ensure that each
mkdir call uses a mode including at least owner-read access.
2005-12-19 18:17:16 +00:00
Jim Meyering 17f521adfd (main) Avoid a minor race condition when `-m MODE' is specified, by using
open, fchown, and close rather than just chown.  To do that reliably
(even with an overly restrictive umask), ensure that each mknod/mkfifo
call uses a mode including at least owner-read access.
2005-12-19 18:16:07 +00:00
Jim Meyering e0029290b8 . 2005-12-19 18:13:00 +00:00
Jim Meyering 89276658f2 . 2005-12-19 18:12:30 +00:00
Jim Meyering 457167610f . 2005-12-19 18:05:55 +00:00
Jim Meyering 1e4cd701dc Require gl_CHMOD_SAFER. 2005-12-19 18:05:11 +00:00
Jim Meyering 5df3b1a078 *** empty log message *** 2005-12-17 13:46:34 +00:00
Jim Meyering 46f3108c99 (is_empty_dir): Open with O_NDELAY, so we don't hang, e.g., on a named pipe.
(OPEN_NO_FOLLOW_SYMLINK): Remove definition.  Use O_NOFOLLOW in
place of all uses, since it is guaranteed (system.h) to be defined.
2005-12-17 13:46:27 +00:00
Jim Meyering eb931cda05 *** empty log message *** 2005-12-17 10:56:25 +00:00
Jim Meyering 88d381bada Add lib/acl.c. 2005-12-17 10:56:22 +00:00
Jim Meyering 26f5a6e03e *** empty log message *** 2005-12-17 10:50:04 +00:00
Jim Meyering 88c3a9be50 (stat invocation) [--printf]: Describe new option.
[--format]: Add example.  Distinguish from --printf.
Sort option descriptions.
2005-12-17 10:50:00 +00:00
Jim Meyering c99e1d2cb6 . 2005-12-17 10:48:30 +00:00
Jim Meyering c4a1355047 *** empty log message *** 2005-12-17 10:48:12 +00:00
Jim Meyering 2862dc7af9 *** empty log message *** 2005-12-17 10:47:37 +00:00
Jim Meyering 01a5f3830f (ls): Clarify the Alternate Access Method description.
(cp): Clarify that --preserve=mode also preserves acls.
2005-12-17 10:46:57 +00:00
Jim Meyering 7b08fdb1eb (cp_option_init): Don't set umask_kill member. 2005-12-17 10:46:23 +00:00
Jim Meyering eee9e3d072 (cp_option_init): Don't set umask_kill member. 2005-12-17 10:45:54 +00:00
Jim Meyering 406a9d3636 (cp_option_init) [umask_kill]: Remove member. 2005-12-17 10:43:12 +00:00
Jim Meyering fdffb6bb48 (umask_kill): With default acls, the umask is not to be applied.
Remove umask_kill, don't change the process umask, and let the kernel
apply the umask where appropriate.
(make_dir_parents_private): Fix logic for POSIX ACLs.
2005-12-17 10:40:10 +00:00
Jim Meyering 4fb20524d7 (dir_LDADD, ls_LDADD, vdir_LDADD, cp_LDADD, mv_LDADD, ginstall_LDADD):
On systems with an ACL library, arrange
to link with it via $(LIB_ACL), for the utilities that need it.
2005-12-17 10:37:47 +00:00
Jim Meyering f634e88445 (get_dest_mode): Remove; it is obsolete after removing umask_kill.
(copy_reg, copy_internal): Use copy_acl and set_acl
instead of fchown/chown. Fix the logic for POSIX ACLs.
(chown_succeded): Remove; we now always copy acls and
preserve S_ISUID, S_ISGID, and S_ISVTX when needed, no matter if we
did a chown before or not.
2005-12-17 10:33:33 +00:00
Jim Meyering e6ece7ba6c Switch back from HAVE_ACL to USE_ACL: The acl() syscall
is no requirement for ACL support; particularly, it does not exist
on systems that have POSIX ACLs.
2005-12-17 10:33:08 +00:00
Jim Meyering 3c0d9bc513 *** empty log message *** 2005-12-17 10:31:37 +00:00
Jim Meyering 4a12f5ebcf (acl_entries): Add fallback implementation for POSIX ACL
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.
2005-12-17 10:31:33 +00:00
Jim Meyering 9566c9c9d3 (copy_acl, set_acl): Add declarations. 2005-12-17 10:31:15 +00:00
Jim Meyering 2eb8cbd948 *** empty log message *** 2005-12-17 10:30:13 +00:00
Jim Meyering f69fb2f533 (AC_FUNC_ACL): Add POSIX ACL and Linux-specific acl tests. 2005-12-17 10:30:09 +00:00
Paul Eggert 1833362111 remove/openat cleanup 2005-12-17 06:56:19 +00:00
Paul Eggert 25c49ccc1c (OPENAT_CWD_RESTORE__REQUIRE): Remove.
(OPENAT_CWD_RESTORE__ALLOW_FAILURE): Likewise.
(fd_to_subdirp): Remove openat_cwd_restore_allow_failure arg; its
value is now signified by whether cwd_errno is null.
(fd_to_subdirp, remove_dir, rm_1); Change cwd failure indicator from
pointer-to-bool to pointer-to-errno-value.  All callers changed.
(rm_1): Don't bother setting a local cwd failure flag and then
ORing it into the caller's.  Just set the caller's.
(rm): Use cwd failure errno value to print a slightly-better
diagnostic.
2005-12-17 06:55:54 +00:00
Paul Eggert 3f86aaadcf Don't include <stdlib.h>, <unistd.h>, <fcntl.h>,
"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.
2005-12-17 06:55:32 +00:00
Paul Eggert 1c5cebe703 Revamp code so that function macros depend on
__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.
2005-12-17 06:55:01 +00:00
Jim Meyering 0ae5a45fcb *** empty log message *** 2005-12-15 20:16:03 +00:00