Commit Graph

4666 Commits

Author SHA1 Message Date
Jim Meyering 0cb6f1cc82 fix typo in comment 2006-01-09 20:32:08 +00:00
Jim Meyering 00d069f7d9 *** empty log message *** 2006-01-06 16:48:27 +00:00
Jim Meyering ea20facd90 (COPYRIGHT_YEAR): Update to 2006. 2006-01-06 16:48:24 +00:00
Jim Meyering 084903a2b1 . 2006-01-04 21:06:39 +00:00
Paul Eggert 15954c3753 (tzname): Don't declare if it is already #defined. 2006-01-04 18:57:24 +00:00
Jim Meyering 0aea37a1b3 *** empty log message *** 2006-01-04 07:13:10 +00:00
Jim Meyering 27ab46340c Merge from glibc.
(fts_open): Avoid function call in MAX macro use.
2006-01-04 07:12:22 +00:00
Paul Eggert a2fa57b24c (xtime_make, xtime_nonnegative_nsec, xtime_nsec): Use
long int, not int, for nanosecond counts, so that people who are
used to POSIX struct timespec won't be surprised.
2006-01-03 23:21:38 +00:00
Jim Meyering b9c62b6747 correct first-line comment 2006-01-03 10:29:58 +00:00
Paul Eggert c0dac69808 New approach to safer chmod. 2006-01-02 07:30:27 +00:00
Paul Eggert bee93bd060 No longer used. 2006-01-02 07:18:30 +00:00
Paul Eggert e59703a1d6 New file. 2006-01-02 06:34:32 +00:00
Paul Eggert c225633528 Include lchmod.h, lchmod.c.
(make_dir_parents): Use lchown rather than chown, and
lchmod rather than chmod.
2006-01-02 06:33:12 +00:00
Paul Eggert eb330d2584 chdir-related fixes 2005-12-27 08:00:42 +00:00
Paul Eggert 97fe820f88 (save_cwd): Don't bother trying to open directory
for write access: POSIX says that must fail.
2005-12-27 07:57:14 +00:00
Paul Eggert ee7334652f (rpl_chown) [CHOWN_MODIFIES_SYMLINK]:
Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
Fall back on chown if open failed with EACCES.
2005-12-27 07:56:33 +00:00
Paul Eggert 0d7468cabd (defined_S_IFMT): New macro.
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.
2005-12-27 07:55:50 +00:00
Paul Eggert cc4d59e9cd (diropen): Don't bother trying to open directory for write access:
POSIX says that must fail.
2005-12-27 07:55:03 +00:00
Paul Eggert 8846a6bfdd (chdir_no_follow): Don't bother trying to open directory for write
access: POSIX says that must fail.
2005-12-27 07:54:37 +00:00
Paul Eggert a2c8ec26a4 (cdb_free): Don't bother trying to open directory
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.
2005-12-27 07:53:50 +00:00
Jim Meyering edf69af317 (chdir_no_follow): Move declaration of local,
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.
2005-12-26 18:53:58 +00:00
Jim Meyering 078800a00b *** empty log message *** 2005-12-26 18:53:46 +00:00
Paul Eggert 7cffc5f20e chdir-safer.c still needs unistd.h 2005-12-25 21:40:01 +00:00
Paul Eggert f7a0d07623 Whoops; don't remove the include for unistd.h, since it defines fchdir. 2005-12-25 21:38:43 +00:00
Paul Eggert 11eedd84d3 chdir-safer cleanup 2005-12-25 21:35:51 +00:00
Paul Eggert 8b9f6b163a (chdir_no_follow): Don't include stdio.h, assert.h,
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).
2005-12-25 21:35:38 +00:00
Paul Eggert 532cf2ac33 (FCHMOD_SAFER_H): Remove: it was misnamed, and wasn't needed anyay. 2005-12-25 21:35:21 +00:00
Jim Meyering 735fb62c0f *** empty log message *** 2005-12-25 17:34:04 +00:00
Jim Meyering d789e78a75 (chdir_no_follow): Remove unnecessary test of S_ISDIR (sb_init.st_mode). 2005-12-25 17:33:57 +00:00
Jim Meyering 7916560259 *** empty log message *** 2005-12-23 18:15:38 +00:00
Jim Meyering 5d3118175f (make_dir_parents): Use chdir_no_follow only
if we've just created the directory.
2005-12-23 18:15:33 +00:00
Jim Meyering bdf801ef29 *** empty log message *** 2005-12-23 17:14:37 +00:00
Jim Meyering 7616f9171a *** empty log message *** 2005-12-23 12:00:37 +00:00
Jim Meyering 2eab9d93fc (chdir_no_follow): Rewrite to use fchdir even
when O_NOFOLLOW is not defined.  Suggested by Eric Blake.
2005-12-23 12:00:26 +00:00
Jim Meyering 867dbd1591 *** empty log message *** 2005-12-23 08:28:19 +00:00
Jim Meyering bd80c2e5a7 (O_NOFOLLOW): Define, if necessary. 2005-12-23 08:28:14 +00:00
Jim Meyering 6ed15904b1 (O_NOFOLLOW): Define. 2005-12-23 08:27:44 +00:00
Jim Meyering 2bd65173c2 *** empty log message *** 2005-12-22 14:36:22 +00:00
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 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 e0029290b8 . 2005-12-19 18:13:00 +00:00