Commit Graph

4979 Commits

Author SHA1 Message Date
Jim Meyering
ecdb09854e (getndelim2): Remove doubled "after" in comment. 2006-07-08 09:58:13 +00:00
Jim Meyering
addbdadf16 Really add wcwidth.h. 2006-07-04 07:28:57 +00:00
Jim Meyering
2880a90019 *** empty log message *** 2006-07-04 07:28:45 +00:00
Jim Meyering
ba761d685f *** empty log message *** 2006-07-04 07:23:10 +00:00
Paul Eggert
6a97405672 Sync from gnulib. 2006-07-04 05:39:07 +00:00
Paul Eggert
71e6c80352 (libcoreutils_a_SOURCES): Add setenv.h, wcwidth.h,
to accommodate sync from gnulib.
2006-07-04 05:37:11 +00:00
Paul Eggert
948ca71450 Include <sys/types.h> after @FULL_PATH_STDINT_H@, for
MacOS X 10.4.6.  Don't mention <sys/int_types.h>.
2006-07-04 04:50:34 +00:00
Jim Meyering
1a29d221b8 * cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
macro is used before the first cycle_check call.
2006-07-03 15:20:23 +00:00
Paul Eggert
001f33d478 (intmax_t, uintmax_t): Prefer long to long long if
both are 64 bits.
2006-07-02 09:15:08 +00:00
Paul Eggert
047839ffb4 Sync stdint module from gnulib. 2006-07-02 07:08:50 +00:00
Paul Eggert
69f1a97138 seq defaults to a minimal fixed point format that does not lose
information if seq's operands are all fixed point decimal numbers.
You no longer need the `-f%.f' in `seq -f%.f 1048575 1024 1050623',
for example, since the default format now has the same effect.

seq now lets you use %a, %A, %E, %F, and %G formats.

seq now uses long double internally rather than double.
2006-07-01 00:11:23 +00:00
Paul Eggert
3964d508e2 (XSTRTOD, DOUBLE): New macros, so that we can support
both double and long double versions.
(XSTRTOD): Renamed from xstrtod.  Use DOUBLE internally.
2006-07-01 00:09:56 +00:00
Paul Eggert
42ae65127f (xstrtold): New decl. 2006-07-01 00:09:22 +00:00
Paul Eggert
74d539a32f Initial revision. 2006-07-01 00:06:11 +00:00
Jim Meyering
2e63aaa8a9 From Derek R. Price:
* lib/strftime.c: Assume strftime exists.
* m4/strftime.m4: Don't call AC_FUNC_STRFTIME.
2006-06-29 21:45:51 +00:00
Paul Eggert
ab621d9fa1 (CLOSEDIR): Remove. All uses changed to closedir. 2006-06-28 22:24:54 +00:00
Paul Eggert
9d5fbcc019 (openat): Use ?:, not if, to work around GCC bug 4210. 2006-06-20 19:20:25 +00:00
Jim Meyering
8280381dd7 fix typo in comment: s/nerrower/narrower/ 2006-06-20 10:19:40 +00:00
Jim Meyering
d5a9087fb1 *** empty log message *** 2006-06-19 19:13:04 +00:00
Jim Meyering
bee8bb4c9b Apply this change from gnulib:
2006-06-16  Eric Blake  <ebb9@byu.net>
* unsetenv.c [!defined errno]: Assume errno.h declares errno.
2006-06-19 19:13:00 +00:00
Paul Eggert
ff276995ff (__attribute__): Don't define if already defined. 2006-06-11 07:11:31 +00:00
Jim Meyering
949ed19da0 Apply this change from gnulib:
2006-05-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
	    Bruno Haible  <bruno@clisp.org>

* strndup.c (strndup) [!_LIBC]: Don't undefine macro definition.
2006-06-10 09:10:12 +00:00
Paul Eggert
f9265a7efe * regexec.c (group_nodes_into_DFAstates): Fix a buffer overrun
reported by Andreas Schwab.
2006-06-05 05:21:46 +00:00
Paul Eggert
e9eb2ad579 (small_open, large_open): New macros.
(__open, __open64) [!_LIBC]: Remove.
(__gen_tempname): Use small_open and large_open instead of __open
and __open64.  This fixes a portability bug on HP-UX 11.11i
reported by Simon Wing-Tang in
<http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00114.html>.
2006-05-25 21:57:22 +00:00
Paul Eggert
8ebe82ae29 Fix misspelling. 2006-05-23 07:48:31 +00:00
Paul Eggert
bd52082675 Note problem with string.h. 2006-05-23 07:48:12 +00:00
Paul Eggert
41f08b2239 filemode.c: Don't include <string.h>. 2006-05-23 07:47:51 +00:00
Paul Eggert
82008e43bd Don't include <string.h>; this include was
inadvertantly put into the previous patch.
2006-05-23 07:47:32 +00:00
Paul Eggert
c512471974 * filemode.c (setst): Remove.
(strmode): Rewrite to avoid setst.  This makes the code shorter,
(arguably) clearer, and the generated code is a bit smaller on my
Debian GNU/Linux stable x86 host.
2006-05-22 20:11:45 +00:00
Paul Eggert
900b6598d1 Document the internals better. Most of this change
was written by Bruno Haible.
2006-05-22 18:01:48 +00:00
Jim Meyering
3e3aff9926 *** empty log message *** 2006-05-20 22:18:20 +00:00
Jim Meyering
8fb9de41d5 (fts_open): Fail with EINVAL if a caller violates this rule:
Either FTS_LOGICAL or FTS_PHYSICAL must be provided to the
fts_open() function.
2006-05-20 22:18:16 +00:00
Paul Eggert
86873e5082 Sync nanosleep from gnulib. 2006-05-19 18:03:25 +00:00
Jim Meyering
db19f3df8b *** empty log message *** 2006-05-15 13:28:28 +00:00
Jim Meyering
212ffe61af (xfts_open): Always use FTS_CWDFD. 2006-05-15 13:28:24 +00:00
Jim Meyering
06918c9589 *** empty log message *** 2006-05-15 10:59:15 +00:00
Jim Meyering
63deb75831 Avoid the expense of an fstat, when possible.
(O_NOFOLLOW, STREQ): Define.
(diropen_fd): Remove function.  Merge it into sole caller...
(diropen): ...here.  Use O_NOFOLLOW when appropriate.
(fts_safe_changedir): Call fstat for dev/inode check, only if the
previous open/openat call may have opened the wrong directory.
2006-05-15 10:59:10 +00:00
Jim Meyering
ad17714291 *** empty log message *** 2006-05-15 10:00:30 +00:00
Jim Meyering
7729ee5e68 Restore the parts of fts that were removed on 2006-01-17, so that
it's easier for legacy applications designed for the version
of fts in glibc or BSD to convert to this more robust version.
Add a new mode, FTS_CWDFD, by which to enable the improved
(openat- based -- aka no-chdir) semantics.

* fts_.h (FTS_CWDFD): Define.  Callers must use this fts_open
option to enable the more robust behavior.
(FTS_OPTIONMASK): Widen accordingly.
* fts.c: Restore removed code, reverting the default behavior.
2006-05-15 10:00:16 +00:00
Jim Meyering
0e3dfb2439 *** empty log message *** 2006-05-11 19:44:47 +00:00
Jim Meyering
3b136eec7b (sha1_buffer): Correct comment: s/MD5/SHA1/. From James Lemley. 2006-05-11 19:44:42 +00:00
Jim Meyering
9980147451 . 2006-05-06 15:52:56 +00:00
Jim Meyering
72049d2e2e *** empty log message *** 2006-05-04 10:33:39 +00:00
Jim Meyering
b400a630ae Include "same-inode.h". 2006-05-03 10:13:07 +00:00
Paul Eggert
972d0198a9 (get_date): When adding relative date, start with the
initial time, not with the result of the first mktime call.
2006-04-25 10:29:47 +00:00
Paul Eggert
ae5252e393 Document filemode changes. 2006-04-17 23:24:49 +00:00
Paul Eggert
99277ba7c6 Don't undef S_ISDOOR, since it's never buggy.
(S_ISDOOR): Don't bother with S_IFDOOR, since that code is never needed.
(S_ISPORT, S_ISWHT): New macros, if not already defined.
2006-04-17 23:22:01 +00:00
Paul Eggert
dc536fbed1 (HAVE_DECL_STRMODE): Include <string.h> for strmode.
(strmode): Renamed from mode_string.
(filemodestring): New decl.
2006-04-17 23:21:30 +00:00
Paul Eggert
ac2d45ce67 Include "filemode.h" first, to test the interface.
Assume that filemode.h includes sys/types.h and sys/stat.h.
(HAVE_ST_DM_MODE): New macro, moved here from ls.c.
(ftypelet): Reorder to put common cases first, for efficiency.
Add 'P', 'w'.  Remove 'M', since it's now the caller's responsibility
to do 'M'.
(strmode): Renamed from mode_string, and now stores 12 bytes instead
of 10, for compatibility with FreeBSD.  All callers changed.
(filemodestring): Now stores 12 bytes instead of 10, and sets file types
that can't be deduced solely from st_mode.  First arg is now a const
pointer.
2006-04-17 23:21:14 +00:00
Jim Meyering
58fab28670 *** empty log message *** 2006-04-17 21:07:53 +00:00
Jim Meyering
415dddb568 *** empty log message *** 2006-04-17 20:53:20 +00:00
Paul Eggert
ade4e95345 (openat_needs_fchdir) [defined __OPENAT_PREFIX]:
Turn this into a macro that always returns true.
2006-04-17 20:48:23 +00:00
Paul Eggert
39448a239a (futimens): glibc futimesat messes up if /proc isn't mounted. 2006-04-15 07:39:46 +00:00
Jim Meyering
ca094485f9 *** empty log message *** 2006-04-14 20:33:42 +00:00
Jim Meyering
52f9cd6688 remove SPACEs before TAB 2006-04-14 16:36:34 +00:00
Jim Meyering
ea26299816 *** empty log message *** 2006-04-14 16:35:44 +00:00
Jim Meyering
47d0eb8722 (fts_open): Don't allocate parent if *argv==NULL. Patch from glibc. 2006-04-14 16:35:41 +00:00
Jim Meyering
8085d02998 (fts_build): Free `head' before returning NULL, in two places,
to avoid leaks.  Patch from glibc.
2006-04-14 16:26:15 +00:00
Jim Meyering
d657c35562 (fts_build): Remove just-#if-0'd code and the code that
declares and sets cderrno.
2006-04-14 16:21:21 +00:00
Jim Meyering
091c012089 (fts_build): #if-0-out a block of unused code. Patch via glibc. 2006-04-14 16:11:01 +00:00
Paul Eggert
52bb8bdd10 Don't use wchar_t or wctype_t; update comment. 2006-04-13 22:17:17 +00:00
Paul Eggert
3125c35bc7 (RE_DUP_MAX): Update comment to match current implementation. 2006-04-13 22:16:58 +00:00
Paul Eggert
372285b207 (init_dfa): Don't use wchar_t or wctype_t if RE_ENABLE_I18N
is not defined.  Problem reported by Mark D. Baushke via Derek R. Price.
2006-04-13 22:16:43 +00:00
Paul Eggert
e0637b5b68 Port to Interix. 2006-04-12 20:15:30 +00:00
Paul Eggert
2fc455e2d5 Include <inttypes.h> and <stdint.h> if they exist. 2006-04-12 20:13:13 +00:00
Paul Eggert
368bc94656 Don't include <inttypes.h> or <stdint.h>, since
fsusage.h now does that.  Include fsusage.h first, to test interface.
Prefer statvfs if it works, since it's blessed by POSIX.  Attempt
at most one method (the old code could have generated decls that
didn't conform to C89, not that this was ever exercised).
2006-04-12 20:13:00 +00:00
Jim Meyering
ba75c95164 remove useless spaces before TABs 2006-04-10 19:15:08 +00:00
Paul Eggert
72021730a8 Import latest regex module from gnulib. 2006-04-10 06:46:07 +00:00
Jim Meyering
a35fc49153 . 2006-03-26 12:33:28 +00:00
Jim Meyering
864c4c28af *** empty log message *** 2006-03-26 12:20:59 +00:00
Jim Meyering
8773d59d55 (base_name): New semantics - malloc the result.
Preserve // when it is special.
Preserve relative files that look like drive letters.
(base_len): Preserve // when it is special.
(last_component): New method, similar to old base_name semantics.
2006-03-26 12:20:46 +00:00
Jim Meyering
8132c6e76e (dir_len): Determine when drive letters need a subsequent slash.
Preserve // when it is special.
(dir_name): Don't append dot when drive letter is absolute.
[TEST_DIRNAME]: Move into a full-blown gnulib test.
2006-03-26 12:20:24 +00:00
Jim Meyering
ba0f1e7d7f (FILE_SYSTEM_PREFIX_LEN): Move here from dos.m4.
[FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]: Don't treat 1: as a drive prefix.
(IS_ABSOLUTE_FILE_NAME): Treat all drive letters as absolute on
platforms like cygwin with FILE_SYSTEM_DRIVE_PREFIX_IS_ABSOLUTE.
(last_component): New method.
2006-03-26 12:20:06 +00:00
Jim Meyering
7029f979e5 (strip_trailing_slashes): Use last_component, not base_name.
Strip redundant slashes from ///.
2006-03-26 12:18:51 +00:00
Jim Meyering
cb916337dc (file_name_concat): s/base_name/last_component/ 2006-03-26 12:16:11 +00:00
Jim Meyering
bfbe80d004 (check_extension, numbered_backup): s/base_name/last_component/ 2006-03-26 12:15:59 +00:00
Jim Meyering
4ecf233b95 (same_name): s/base_name/last_component/ 2006-03-26 12:14:16 +00:00
Jim Meyering
7cf97ab1ff *** empty log message *** 2006-03-19 18:27:55 +00:00
Jim Meyering
164d936ac2 Work even in a chroot where d_ino values for entries in "/"
don't match the stat.st_ino values for the same names.

(__getcwd): When no d_ino value matches the target inode
number, iterate through all entries again, using lstat instead.
Reported by Kenshi Muto in http://bugs.debian.org/355810.
2006-03-19 18:27:51 +00:00
Jim Meyering
e233777dbe (__getcwd): Clarify a comment.
Use memcpy in place of a call to strcpy.
2006-03-19 17:18:32 +00:00
Paul Eggert
7202bc0610 regex fixes for future POSIX and --without-included-regex. 2006-03-17 07:35:25 +00:00
Paul Eggert
d01c74cabd (regoff_t) [defined _REGEX_LARGE_OFFSETS]:
Typedef to long int, not to off_t, as POSIX will likely change
in that direction.
2006-03-17 07:33:40 +00:00
Jim Meyering
de33c6c49d . 2006-03-12 22:47:35 +00:00
Jim Meyering
4798c23152 *** empty log message *** 2006-03-12 22:05:59 +00:00
Jim Meyering
f497e71465 *** empty log message *** 2006-03-12 22:03:37 +00:00
Jim Meyering
5ff988ec22 (leave_dir): If cycle-check's saved dev-ino pair matches
that of the current directory (which we're about to chdir ".." out of),
then save the dev-ino of the parent, instead.
2006-03-12 22:03:17 +00:00
Jim Meyering
ac1e215dc2 *** empty log message *** 2006-03-12 22:02:12 +00:00
Jim Meyering
275d9242ff (SAME_INODE): Remove definition. 2006-03-12 22:02:03 +00:00
Jim Meyering
fa44d25fdb Include "same-inode.h".
(CYCLE_CHECK_REFLECT_CHDIR_UP): Define.
2006-03-12 22:01:29 +00:00
Jim Meyering
6ae28d0eb5 (SAME_INODE): Remove definition.
Include "same-inode.h", instead.
2006-03-12 21:59:55 +00:00
Jim Meyering
1ccf35a5e3 (SAME_INODE): Remove definition.
Include "same-inode.h", instead.
2006-03-12 21:59:29 +00:00
Jim Meyering
dc73889ce6 (SAME_INODE): New file/macro. 2006-03-12 20:45:31 +00:00
Paul Eggert
99db964248 Remove asctime_r, ctime_r, and let m4 specify the sources. 2006-03-12 08:07:34 +00:00
Paul Eggert
be8d40f7e7 (asctime_r, ctime_r): Remove. 2006-03-12 08:06:00 +00:00
Paul Eggert
9c4784e50e (libcoreutils_a_SOURCES): Remove time_r.c, time_r.h,
as this is now done in m4.
2006-03-12 08:05:22 +00:00
Jim Meyering
0c0d4f5707 . 2006-02-27 10:54:09 +00:00
Jim Meyering
d3ae5ba2b4 *** empty log message *** 2006-02-27 10:52:48 +00:00
Jim Meyering
51fd587ca6 *** empty log message *** 2006-02-27 10:52:01 +00:00
Jim Meyering
0374086247 *** empty log message *** 2006-02-27 10:51:36 +00:00
Jim Meyering
021990a737 (libcoreutils_a_SOURCES): Add base64.h and base64.c. 2006-02-27 10:49:40 +00:00
Paul Eggert
6870eeeaff (AT_FDCWD): Work around a bug in Solaris 9 and 10, where
AT_FDCWD exceeds INT_MAX.
2006-02-21 06:42:29 +00:00
Jim Meyering
3f7e0c2173 . 2006-02-20 13:00:54 +00:00
Jim Meyering
74699a2b52 *** empty log message *** 2006-02-16 23:10:27 +00:00
Jim Meyering
1ec610ba19 Include lstat.h, so that uses of lstat are converted
to uses of rpl_lstat, e.g., on Solaris 9.  Otherwise, programs like
du (which now uses the openat-enabled fts and hence fstatat) would
mistakenly fail to dereference a symlink-to-directory specified
with a trailing slash.
2006-02-16 23:10:01 +00:00
Paul Eggert
05e61daca4 Sync from gnulib. 2006-02-14 23:08:59 +00:00
Paul Eggert
de107e9110 Fix typo in previous checkin: I deleted a '2' by mistake. 2006-02-11 00:36:08 +00:00
Paul Eggert
b455780a19 (close_stdout): Don't assume 'bool' converts nonzero
ints to 0 or 1, as this isn't true for the stdbool.h substitute.
2006-02-08 00:08:38 +00:00
Jim Meyering
9a8fc54523 *** empty log message *** 2006-02-02 21:25:10 +00:00
Jim Meyering
b88d20f978 Eliminate the unwelcome (albeit unlikely) possibility of xmalloc
failure on deficient systems, and simplify gnulib lgpl dependencies.

(rpl_lstat): Rewrite to use stat() in place of the
xmalloc/lstat combination.  Based on a patch from Bruno Haible.
2006-02-02 21:25:06 +00:00
Paul Eggert
32aba5ac50 (L_): Renamed from L. All uses changed. 2006-01-27 18:41:50 +00:00
Paul Eggert
da953b9d22 Sync stdbool from gnulib. 2006-01-26 21:01:56 +00:00
Paul Eggert
a768b3ebec Merge stdbool from gnulib; we're still not quite there yet. 2006-01-25 18:32:46 +00:00
Paul Eggert
1a9e9d670d (true, false) [defined __BEOS__]: undef, as before.
(_Bool) [!@HAVE__BOOL@ && defined __GNUC__]: Use an enum
rather than a #define.
2006-01-25 18:32:19 +00:00
Jim Meyering
e2c3daca96 . 2006-01-25 08:05:45 +00:00
Jim Meyering
292e0cdfa6 Remove useless parentheses in cpp directive. 2006-01-25 07:44:28 +00:00
Jim Meyering
0a42446129 *** empty log message *** 2006-01-25 07:43:20 +00:00
Jim Meyering
d433382eaa Remove useless parentheses in cpp directive. 2006-01-25 07:43:17 +00:00
Paul Eggert
a30a9a3ec4 Import from gnulib. 2006-01-24 07:52:03 +00:00
Jim Meyering
4cf7d77126 *** empty log message *** 2006-01-23 15:06:42 +00:00
Jim Meyering
e17e330140 Remove unused definition of N_. 2006-01-23 15:06:37 +00:00
Paul Eggert
7c364b54fc (quotearg_buffer_restyled): Add "default: break;"
to pacify gcc -Wswitch-default.
2006-01-22 08:46:54 +00:00
Jim Meyering
3173cb27dd . 2006-01-21 11:17:19 +00:00
Jim Meyering
d55e2d8528 (openat_needs_fchdir): New function. 2006-01-17 17:43:10 +00:00
Jim Meyering
88df081621 *** empty log message *** 2006-01-17 17:42:57 +00:00
Jim Meyering
264f1bc3cd (openat_needs_fchdir): Declare it. 2006-01-17 17:42:53 +00:00
Jim Meyering
e9f0c42afc *** empty log message *** 2006-01-17 17:24:38 +00:00
Jim Meyering
a28b096d7f [struct FTS] (fts_cwd_fd): New member.
[struct FTS] (fts_rft): Remove now-unused member.
[struct FTS] (fts_cycle.state): Improve comment.
2006-01-17 17:24:29 +00:00
Jim Meyering
c1994c16c2 Rewrite fts.c not to change the current working directory,
by using openat, fstatat, fdopendir, etc..

[! _LIBC]: Include "openat.h" and "unistd--.h".
(HAVE_OPENAT_SUPPORT): Define.
[_LIBC] (fchdir): Don't undef or define; no longer used.
(FCHDIR): Define in terms of cwd_advance_fd rather than fchdir.
Now, this `function' always succeeds, and consumes its file descriptor
parameter -- so callers must not close such FDs.  Update callers.
(diropen_fd, opendirat, cwd_advance_fd): New functions.
(diropen): Add parameter, SP.  Adjust all callers.
Implement using diropen_fd, rather than open.
(fts_open): Initialize new member, fts_cwd_fd.
Remove fts_rft-setting code.
(fts_close): Close fts_cwd_fd, if necessary.
(__opendir2): Define in terms of opendir or opendirat,
depending on whether the FST_NOCHDIR flag is set.
(fts_build): Since fts_safe_changedir consumes its FD, and since
this code must do `closedir(dirp)', dup the dirfd(dirp) argument,
and close the dup'd file descriptor upon failure.
(fts_stat): Use fstatat(...AT_SYMLINK_NOFOLLOW) in place of lstat.
(fts_safe_changedir): Tweak semantics to reflect that this function
now calls cwd_advance_fd and hence consumes its FD argument.
2006-01-17 17:24:14 +00:00
Jim Meyering
7dabfc7e73 . 2006-01-12 08:40:34 +00:00
Jim Meyering
c27afc1a04 *** empty log message *** 2006-01-12 07:55:40 +00:00
Jim Meyering
b78b7818af Remove useless parentheses in cpp directives, so that
this file passes coreutils' `make syntax-check' tests.
2006-01-12 07:55:36 +00:00
Paul Eggert
9b6eae76de Import from gnulib. 2006-01-12 07:21:34 +00:00
Paul Eggert
ea58c1150c Add stdint_.h. 2006-01-12 07:21:19 +00:00
Paul Eggert
518d041db8 Adjust to md5 changes in gnulib, and make sha1 etc. more consistent
with md5.
2006-01-12 07:19:50 +00:00
Paul Eggert
3f83336726 (struct sha512_ctx): Use a word buffer, not a byte buffer, so that we
don't need to worry about alignment.
2006-01-12 07:18:39 +00:00
Paul Eggert
a60af3a64f (struct sha256_ctx): Use a word buffer, not a byte buffer, so that we
don't need to worry about alignment.  All uses changed.
2006-01-12 07:18:13 +00:00
Paul Eggert
25962cd489 (struct sha1_ctx): Use a word buffer, not a byte buffer,
so that we don't need to worry about alignment.  All uses changed.
This merges the 2005-10-28 md5 change into sha1.
2006-01-12 07:17:51 +00:00
Paul Eggert
1834ba06ac Fix commentary to match md5 better. Adjust to .h file changes. 2006-01-12 07:17:25 +00:00
Paul Eggert
3024d13d7e (__attribute__): Remove; unused. 2006-01-12 07:16:33 +00:00
Paul Eggert
7354a360be Fix commentary typos.
(alignof, UNALIGNED_P): No need for a GCC-specific version.
2006-01-12 07:16:21 +00:00
Paul Eggert
71b4960878 (BUILT_SOURCES, EXTRA_DIST, stdint.h, MOSTLYCLEANFILES):
Add gnulib snippet.
2006-01-12 07:16:07 +00:00
Paul Eggert
aa038250c3 Add stdint.h. 2006-01-12 07:15:48 +00:00
Jim Meyering
4eafb9d163 *** empty log message *** 2006-01-11 22:11:49 +00:00
Jim Meyering
50114df430 *** empty log message *** 2006-01-11 21:32:56 +00:00
Jim Meyering
108b46760a *** empty log message *** 2006-01-11 21:00:42 +00:00
Jim Meyering
cf6281916b (fts_stat): When following a symlink-to-directory,
don't interpret all stat-fails+lstat-succeeds as indicating a
dangling symlink.  That can also happen at least for ELOOP.
The fix: return FTS_SLNONE only when the stat errno is ENOENT.
2006-01-11 21:00:36 +00:00
Jim Meyering
f9574570b3 *** empty log message *** 2006-01-11 16:30:08 +00:00
Jim Meyering
08e4a9a00e (fts_open): Put new (2006-01-04) maxarglen declaration and uses in their
own block, so pre-c99 compilers don't object.
2006-01-11 16:29:35 +00:00
Jim Meyering
f84dc6ccfc *** empty log message *** 2006-01-11 16:19:06 +00:00
Jim Meyering
614235c849 [!_LIBC]: Include "fcntl--.h", to map open to open_safer. 2006-01-11 16:18:39 +00:00
Jim Meyering
dc9da6bde0 *** empty log message *** 2006-01-11 13:33:03 +00:00
Jim Meyering
0e42486491 (fchmodat, fchownat): Declare.
(chmodat, lchmodat): Define convenience functions.
(chownat, lchownat): Likewise.
2006-01-11 13:32:47 +00:00
Jim Meyering
9cbd6c0366 (fchownat): New function. 2006-01-11 13:32:03 +00:00
Jim Meyering
c6749127ca (fchmodat): New file and function. 2006-01-11 13:30:31 +00:00
Jim Meyering
06df842f61 *** empty log message *** 2006-01-11 10:07:22 +00:00
Jim Meyering
d1fe298155 (OP): Remove useless space-before-TAB. 2006-01-11 10:07:13 +00:00
Paul Eggert
e06993903e Sync from gnulib. 2006-01-10 20:13:35 +00:00
Paul Eggert
388f158acf Update copyright year. 2006-01-10 20:05:53 +00:00
Paul Eggert
00eeaec5f2 Remove stray "lib/"s in previous change. 2006-01-10 20:01:34 +00:00
Paul Eggert
d11af4159e Sync from gnulib. 2006-01-10 17:47:56 +00:00
Jim Meyering
71520b31c0 *** empty log message *** 2006-01-10 11:55:20 +00:00
Jim Meyering
58e925ce5f Avoid the double-free (first in fts_read, second in fts_close) that
would occur when an `active' directory is made inaccessible (e.g.,
via chmod a-x) during a traversal.

(fts_read): After a failed fchdir, update sp->fts_cur
before returning.  Reproduce this failure by
mkdir -p a/b; cd a; chmod a-x . b
Reported by Stavros Passas.
2006-01-10 11:55:13 +00:00
Jim Meyering
e774de2be6 *** empty log message *** 2006-01-10 10:23:27 +00:00
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