Commit Graph

3694 Commits

Author SHA1 Message Date
Paul Eggert 1b94625f19 backupfile.c rewrite to avoid arbitrary limits on lengths of
numeric backup extensions.

Include "backupfile.h" first.
Include errno.h, stdbool.h, limits.h, unistd.h, xalloc.h.
(CLOSEDIR, INT_STRLEN_BOUND): Remove.
(pathconf) [! (HAVE_PATHCONF && defined _PC_NAME_MAX)]: New macro.
(_POSIX_NAME_MAX) [!defined _POSIX_NAME_MAX]: New macro.
(NAME_MAX_MAXIMUM): New macro.  Unlike the old addext.c, we
also look at _XOPEN_NAME_MAX, for better performance on modern
hosts that support only file names of length 255 or more.
(ISDIGIT): unsigned -> unsigned int
(max_backup_version, version_number): Remove.
(check_extension): New function.  Similar to the old addext, but
static, assumes that the extension has already been added,
and a bit more careful on DOS hosts.
(numbered_backup): New function.  It does what max_backup_version
and version_number used to do, but it doesn't use integer arithmetic
to calculate extensions so it doesn't overflow.
(find_backup_file_name): Rewrite to use these new functions.
This has a new optimization: we needn't call pathconf if the
new numbered backup name has the same length as the old.
Also, use xmalloc rather than malloc, so that the caller
needn't worry about memory exhaustion.
2004-07-27 23:12:56 +00:00
Paul Eggert bdf757d699 backupfile.h (addext): Remove decl. 2004-07-27 23:12:17 +00:00
Paul Eggert 4e5aa1e97b (libfetish_a_SOURCES): Remove addext.c. 2004-07-27 23:11:55 +00:00
Paul Eggert 5538bf8921 euidaccess fixes 2004-07-25 07:40:32 +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 60a96eb684 Regenerate. 2004-07-23 22:41:52 +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 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 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 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 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 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
Jim Meyering bb11ba8316 . 2004-07-06 17:00:53 +00:00
Jim Meyering 2b19667f16 Include "stat-macros.h".
(canonicalize_filename_mode): Remove #ifdef S_ISLNK, now that
S_ISLNK is guaranteed to be defined (via stat-macros.h).
2004-07-06 17:00:36 +00:00
Jim Meyering 260a2f0a47 *** empty log message *** 2004-07-06 16:56:30 +00:00
Jim Meyering b2c18c67d4 (libfetish_a_SOURCES): Add canonicalize.c unconditionally. 2004-07-06 16:56:21 +00:00
Jim Meyering 51dfe9cc31 (canonicalize_mode_t): New type. 2004-07-06 16:55:40 +00:00
Jim Meyering 17b22ef83f Include "file-type.h".
(canonicalize_filename_mode): New function, based on
canonicalize_file_name, supports three canonicalize modes.
(canonicalize_file_name)
[!HAVE_CANONICALIZE_FILE_NAME && !HAVE_RESOLVEPATH]: Use it.
2004-07-06 16:55:26 +00:00
Jim Meyering 554dc97975 *** empty log message *** 2004-07-05 08:41:43 +00:00
Jim Meyering a8aa538b09 (path_concat): Improve comment. From Paul Eggert. 2004-07-05 08:41:13 +00:00
Jim Meyering 325a75af63 *** empty log message *** 2004-07-04 20:14:52 +00:00
Jim Meyering 034b4caa6d (mempcpy): Don't define if a system header defines it.
Don't include stdio.h, stdlib.h, unistd.h, strdup.h.
(longest_relative_suffix): New function.
(path_concat): Use it.  Assume first argument is not NULL.
Port to DOS.  Omit redundant separators.
Report an error instead of returning NULL.
Use mempcpy instead of memcpy.
(xpath_concat): Remove: not declared or used.
2004-07-04 20:14:44 +00:00
Jim Meyering 6ce20e8caa (canonicalize_file_name): Assume that path_concat never returns NULL. 2004-07-04 18:03:07 +00:00
Jim Meyering 53d0e321ec . 2004-06-30 22:40:52 +00:00
Jim Meyering 6e7b53a45e (FILE_SYSTEM_PREFIX_LEN): Renamed from
FILESYSTEM_PREFIX_LEN.  All uses changed.
2004-06-30 22:40:47 +00:00
Jim Meyering 1a9ba9e774 Use `file system', not filesystem in a comment. 2004-06-30 22:40:20 +00:00
Jim Meyering 7f540c0660 (read_file_system_list): Renamed from read_filesystem_list.
All definitions and uses changed.
2004-06-30 22:39:59 +00:00
Jim Meyering c56f9d7cb0 Use `file system', not filesystem in a comment. 2004-06-30 22:39:13 +00:00
Jim Meyering 49d4a73415 (FILE_SYSTEM_PREFIX_LEN): Renamed from
FILESYSTEM_PREFIX_LEN.  All uses changed.
2004-06-30 22:38:03 +00:00
Jim Meyering 937b5e0826 (read_file_system_list): Renamed from
read_filesystem_list.  All definitions and uses changed.
2004-06-30 22:37:20 +00:00
Jim Meyering c791a273d0 (FILE_SYSTEM_PREFIX_LEN): Renamed from
FILESYSTEM_PREFIX_LEN.  All uses changed.
2004-06-30 22:37:03 +00:00
Jim Meyering e18cbbebac *** empty log message *** 2004-06-24 05:54:01 +00:00
Jim Meyering affbbb2238 (obstack_base): Fix parentheses. From Paul Eggert. 2004-06-24 05:53:54 +00:00
Jim Meyering 2ea2857ed4 . 2004-06-21 15:36:56 +00:00
Jim Meyering 9ad2bf0af5 . 2004-06-20 14:02:47 +00:00
Jim Meyering 6c97ac18ef (obstack_base): Cast to (void *), per documentation. 2004-06-20 13:44:53 +00:00
Jim Meyering 1d5cfee4d8 *** empty log message *** 2004-06-20 13:42:43 +00:00
Jim Meyering 7ce1ce7e7d *** empty log message *** 2004-06-20 13:42:32 +00:00
Jim Meyering 19e8479c86 (libfetish_a_SOURCES): Add yesno.h. 2004-06-20 13:42:30 +00:00