Commit Graph

18971 Commits

Author SHA1 Message Date
Paul Eggert
be7b1ba252 Regenerate. 2004-07-25 07:48:17 +00:00
Paul Eggert
5538bf8921 euidaccess fixes 2004-07-25 07:40:32 +00:00
Paul Eggert
20b73f214c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
(eaccess): Remove.  All users changed to use euidaccess instead.
2004-07-25 07:39:02 +00:00
Paul Eggert
b93109eedc pathchk.c: Include euidaccess.h.
(dir_ok): Use euidaccess, not access.
2004-07-25 07:38:39 +00:00
Paul Eggert
34d19d25d5 (gl_PREREQ): Invoke gl_FUNC_NONREENTRANT_EUIDACCESS,
not gl_FUNC_EUIDACCESS.
2004-07-25 07:38:19 +00:00
Paul Eggert
b46f08fd59 (gl_FUNC_NONREENTRANT_EUIDACCESS): New macro.
(gl_FUNC_EUIDACCESS): Use AC_CHECK_DECLS_ONCE, not AC_CHECK_DECLS.
(gl_PREREQ_EUIDACCESS): Check for eaccess and setregid decls.
Require AC_HEADER_STAT.
2004-07-25 07:37:55 +00:00
Paul Eggert
6fb55c3b5a [!defined LIBC]: Included group-member.h, stat-macros.h.
(S_IXUSR, S_IXGRP, S_IXOTH, S_IROTH, S_IWOTH, S_IXOTH):
Remove; now done by stat-macros.h.
(NGROUPS_MAX, group_member): Remove; now down by group-member.h.
No need to include <limits.h>.
(errno): Remove decl; we now assume C89 or better.
(access, getuid, getgid, geteuid, getegid, stat) [defined _LIBC]:
New macros.
(uid, gid, have_ids): Remove these static variables.
They weren't accurate for programs that also invoked setreuid etc.
(euidaccess) [defined EFF_ONLY_OK || defined ACC_SELF ||
HAVE_DECL_EACCSS]: Use builtin substitutes.
[defined _LIBC]: Ignore __libc_enable_secure; it's not a
correct optimization for programs run as root that later
invoke setreuid.
[no builtin substitutes && HAVE_DECL_SETREGID &&
PREFER_NONREENTRANT_EUIDACCESS]:
Use setreuid+setregid to get the correct answer.
[no builtin substitutes && ! (HAVE_DECL_SETREGID &&
PREFER_NONREENTRANT_EUIDACCESS)]:
Don't assume that the stat macros have their historical values,
as POSIX doesn't require this.
[defined TEST]: Include <stdlib.h>; don't include errno.h
twice; include <error.h> rather than "error.h".
2004-07-25 07:37:22 +00:00
Paul Eggert
ac04178e31 Move some changelog entries here from ../ChangeLog. 2004-07-24 08:03:55 +00:00
Paul Eggert
3949476b46 Fix non-null-terminated-string bugs in who and uptime. 2004-07-24 08:03:40 +00:00
Paul Eggert
a6411b5d54 (print_uptime) [defined BOOT_MSG]:
Don't assume ut_line is null-terminated.
2004-07-24 08:03:02 +00:00
Paul Eggert
d3d39f9a3e (print_line): New arguments USERLEN and LINELEN, since USER and LINE
might not be null terminated.  All callers changed.
2004-07-24 08:01:49 +00:00
Paul Eggert
60a96eb684 Regenerate. 2004-07-23 22:41:52 +00:00
Paul Eggert
35c8fbacab Fix bug with tail -f and pipes, plus a few other problems with tail. 2004-07-23 22:36:07 +00:00
Paul Eggert
85e5128190 Add fcntl-safer. 2004-07-23 22:35:47 +00:00
Paul Eggert
ba1e6b0184 (gl_PREREQ): Add gl_FCNTL_SAFER. 2004-07-23 22:35:07 +00:00
Paul Eggert
441462ac72 Include fcntl-safer.h.
(COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
(COPY_A_BUFFER): New macro.
(struct File_spec): New members mtime, mode, blocking.
Remove member n_consecutive_size_changes.
(DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
max_n_consecutive_size_changes_between_opens,
MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
(long_options, tail_forever, parse_options):
Remove (non-)support for --max-consecutive-size-changes.
(record_open_fd): New function.
(recheck, tail_file): Use it.  Don't assume that stdin is open.
(dump_remainder): Add support for new COPY_A_BUFFER special value.
Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
(recheck): New arg BLOCKING, specifying whether to use blocking reads.
All uses changed.
(n_live_files): Remove, replacing with...
(any_live_files): New function.  All uses changed.
(tail_forever): Use nonblocking I/O unless we know that blocking I/O
is safe; this avoids some hangs when reading from a fifo.
Avoid invoking fstat or sleep when using blocking I/O.
Do not check for changes to size if the file is not a regular file,
as the size is undefined in that case.
Check for changes to mtime or mode, too; this works for non-regular
files.
(tail_forever, main): Redo fflush strategy to work even when input
is nonblocking.  Don't use unbuffered output; just flush when needed.
2004-07-23 22:33:51 +00:00
Paul Eggert
61b792fc38 (libfetish_a_SOURCES): Add fcntl-safer.h, open-safer.c. 2004-07-23 22:33:23 +00:00
Paul Eggert
40ac111df8 New file. 2004-07-23 22:31:32 +00:00
Paul Eggert
c8ab5c1358 (tail invocation): "size has remained the same"
-> "file has not changed", which is more accurate for fifos.
2004-07-23 22:11:49 +00:00
Paul Eggert
2ebcff3337 tail: Fix bug with -f and pipes; remove --max-consecutive-size-changes. 2004-07-23 22:11:15 +00:00
Paul Eggert
af73da6cdf Regenerate. 2004-07-22 20:58:52 +00:00
Paul Eggert
21e0573220 Add fix for "tail -f" when stdin is a pipe. 2004-07-22 20:55:12 +00:00
Paul Eggert
1391d2dc5c Reinstate f-1 test, since we now pass.
Add a new commented-out f-2 test, which we still fail.
(test_vector): All f-* tests are special cases, not just f-1.
2004-07-22 20:54:53 +00:00
Paul Eggert
3f565ee1fe (tail invocation): Do not ignore -f for
all pipes, just for when standard input is a pipe and no
file operand is specified.
2004-07-22 20:54:33 +00:00
Paul Eggert
255eb9cf44 (main): Ignore -f if no file operand is specified
and standard input is a pipe.
2004-07-22 20:54:04 +00:00
Paul Eggert
e5d9694985 Prefer c_strtod to setlocale when scanning floating point. 2004-07-13 00:07:26 +00:00
Paul Eggert
92a74b0a88 Include <errno.h>, <stdio.h>, <stdlib.h> even
if HAVE_GETLOADAVG is defined, so that the test program can work.
(errno): Remove declaration; not needed in C89 or later.
Include "c-strtod.h".
Do not include locale.h or define setlocale; no longer needed.
Include <limits.h>.
(INT_STRLEN_BOUND): New macro.
(getloadavg): Use it to compute buffer size.
Don't assume that buffer will be properly terminated by 'read'.
Use c_strtod instead of setlocale.
(main) [defined TEST]: Return int, not void.
2004-07-12 18:19:38 +00:00
Paul Eggert
6301ff874e Include c-strtod.h.
(print_uptime): Use c_strtod instead of setlocale and sscanf.
Use long int rather than int to count days (for 64-bit hosts),
and check for arithmetic overflow when converting double to time_t.
2004-07-12 17:55:06 +00:00
Paul Eggert
576958b1fd (gl_C_STRTOD): Add gl_USE_SYSTEM_EXTENSIONS. 2004-07-12 17:50:28 +00:00
Paul Eggert
955aa2dc77 (STRTOD_L): New macro.
(C_STRTOD) [defined LC_ALL_MASK]: Use it, so that the
code is reentrant on platforms that have strtod_l.
2004-07-12 17:50:11 +00:00
Paul Eggert
70c9129e14 Regenerate. 2004-07-12 06:43:20 +00:00
Paul Eggert
c3334f85b6 Regenerate. 2004-07-12 06:42:43 +00:00
Paul Eggert
618dd92be6 printf now uses long double. 2004-07-12 06:40:24 +00:00
Paul Eggert
6ab31c1e23 New file. 2004-07-12 06:39:23 +00:00
Paul Eggert
830de27082 (vstrtold): Renamed from vstrtod.
Now returns long double.  All uses changed.
(print_direc): Use "L" length modifier when printing floating point
numbers, since we're now printing long double.
2004-07-12 06:36:55 +00:00
Paul Eggert
bae8432a9b (gl_PREREQ): Add gl_C_STRTOLD. 2004-07-12 06:36:02 +00:00
Paul Eggert
fdfe049a93 New file. 2004-07-12 06:31:53 +00:00
Paul Eggert
9b8e02c39e (c_strtold): New decl. 2004-07-12 06:31:01 +00:00
Paul Eggert
d06984e2be Include <config.h> first.
(C_STRTOD, DOUBLE, STRTOD): New macros.
(c_strtod): Use them.
2004-07-12 06:30:36 +00:00
Paul Eggert
c98f2fb04a (libfetish_a_SOURCES): Add c-strtold.c. 2004-07-12 06:29:59 +00:00
Jim Meyering
c5211912ed . 2004-07-08 14:04:35 +00:00
Jim Meyering
dd0d9c278a *** empty log message *** 2004-07-08 14:03:45 +00:00
Jim Meyering
405c640f5b printf cleanup, to avoid undefined behavior, to add support for
formats that Bash supports, and to support wide integers like
Bash does.

Add tests for the above.
2004-07-08 14:03:20 +00:00
Jim Meyering
3f61615681 *** empty log message *** 2004-07-08 14:01:59 +00:00
Jim Meyering
62e1d5259d printf cleanup, to avoid undefined behavior, to add support for
formats that Bash supports, and to support wide integers like
Bash does.

(UNSPECIFIED): Remove.  All uses now replaced by
booleans, so that we don't reserve any values for precision or
width (like Bash).
(STRTOX): Use prototype, not K&R-style definition.
(vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
in ../lib), with type change to intmax_t.
All uses changed.
(vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
All uses changed.
(vstrtod): Renamed from xstrtod.  All uses changed.
(print_direc): Use boolean arg instead of special value to indicate
a missing precision or width.  LENGTH no longer includes
length modifiers or conversion character.  New arg CONVERSION
now specifies conversion character.
Use intmax_t-width formatting for integers (like Bash).
Add support for C99 %a, %A, %F (like Bash).
Add support for field width with %c (POSIX requires this).
Add a FIXME for lack of support for field width and precision
for %b.
Add support for '\'', '0' flags.
Check for invalid combinations of flags, field width, precision,
and conversion, to prevent use of undefined behavior.
Allow multiple length modifiers, for formats like "%lld" (like Bash).
Add support for C99 'j', 't', 'z' length modifiers (like Bash).
In error message, output entire invalid conversion specification,
instead of merely outputting % followed by the conversion char.
2004-07-08 14:01:49 +00:00
Jim Meyering
2aa1f2d16b *** empty log message *** 2004-07-07 15:54:54 +00:00
Jim Meyering
f1314a409c Don't infloop when MAXSYMLINKS is not defined.
Detect symlink loops much earlier (albeit lazily) on systems
with MAXSYMLINKS defined to a large value.

Include "cycle-check.h".
(canonicalize_filename_mode): Don't try to detect loops by counting
symlink-hops.  Instead, use the cycle-check module.
2004-07-07 15:54:51 +00:00
Jim Meyering
ff5ea92271 Include stdbool.h.
Forward-declare `struct stat'.
2004-07-07 15:07:08 +00:00
Jim Meyering
de9faabfe6 *** empty log message *** 2004-07-07 09:28:24 +00:00
Jim Meyering
f7975d11d7 (canonicalize_filename_mode): Remove do-while(0) loop.
Replace each corresponding `break' stmt with `continue'.
2004-07-07 09:28:15 +00:00