summaryrefslogtreecommitdiff
path: root/src/shred.c
AgeCommit message (Collapse)Author
2006-11-27Improve the check for departures from C89, and fix the departuresPaul Eggert
I found. * Makefile.maint (my-distcheck): Also check for C89 compatibility as best we can with GCC. * src/stat.c (PRINTF_OPTION): Omit comma before } in enum declaration; C89 doesn't allow this. * src/dcgen: Don't generate string literals longer than what C89 requires support for. * src/cut.c (usage): Don't use string literals longer than what C89 requires support for. * src/date.c (usage): Likewise. * src/dd.c (usage): Likewise. * src/du.c (usage): Likewise. * src/ls.c (usage): Likewise. * src/od.c (usage): Likewise. * src/readlink.c (usage): Likewise. * src/seq.c (usage): Likewise. * src/shred.c (usage): Likewise.
2006-10-10* src/ls.c (quote_name): Use initializer rather than memset toPaul Eggert
initialize an object to zero. This is easier to read and is less likely to introduce an runtime error due to a mixup. It causes gcc -W to issue a warning, but you can work around this by appending -Wno-missing-field-initializers. * src/pathchk.c (portable_chars_only): Likewise. * src/shred.c (main): Likewise. * src/stty.c (main): Likewise. * src/tr.c (card_of_complement): Likewise. * src/wc.c (wc): Likewise.
2006-09-03Don't include dirname.h, since system.h does it now.Paul Eggert
2006-08-26Include <config.h> unconditionally, since we now assume config.h exists.Paul Eggert
2006-08-25Fix typo in previous checkin; a "&" went missing.Paul Eggert
2006-08-25Rewrite to avoid some unnecessary casts, macros, literals.Paul Eggert
(DEFAULT_PASSES, VERBOSE_UPDATE): Now constants, not macros. (SECTOR_SIZE, SECTOR_MASK): New constants. (fillpattern, dopass, do_wipefd, main): Remove unnecessary casts, and use the SECTOR_* constants when applicable. Check for size < 0 rather than size == -1, since negative-size files are a sign of trouble anyway. (dopass): Assume a continuable error if EIO even if the current position is not a multiple of 512.
2006-08-13* src/shred.c (usage): Don't indent the second line of an item.Jim Meyering
Otherwise, help2man would misformat the output. Reported by Adam Buchbinder in <https://launchpad.net/bugs/48917>.
2006-08-08Use new random-number interface rather than rand-isaac.c.Paul Eggert
Don't include rand-isaac.c; include randint.h and randread.h instead. (RANDOM_SOURCE_OPTION): New enum. (long_opts, usage, main): New option --random-source. (struct irand_state, irand_init, irand32, irand_mod): Remove. All callers changed to use randint interface. (fillrand): Remove. All callers changed to use randread interface. (dopass): Remove dependency on ISAAC buffer size. (genpattern): Don't wipe the random state here. (randint_source): New static var. (clear_random_data): New function. (main): Allocate random source, and arrange to wipe it on exit.
2006-04-19(fillrand): The assertion was way too weak, due toPaul Eggert
what must be a typo. Strengthen it to its intended value. (dopass): Don't use alloca; it's not worth the aggravation here, since it's used only to get a page-aligned buffer, and page alignment doesn't buy us much here. I'm suspicious that alloca causes problems on some hosts, due to a recent bug report by Adam Waltman.
2006-03-26(wipename): Use new last_component, in place of base_name.Jim Meyering
2005-12-27(wipename): Use similar open flags to other places we open directories.Paul Eggert
Don't bother trying to open dir for writing, since POSIX prohibits it.
2005-12-12(struct irand_state, irand_init, irand32, irand_mod): Moved back here,Paul Eggert
from rand-isaac.c.
2005-12-12Include rand-isaac.c rather than rand-isaac.h.Paul Eggert
(fillrand, dopass, main): Undo previous change.
2005-12-10Don't include gethrxtime.h. No longer needed.Jim Meyering
2005-12-10Include rand-isaac.h. Move ISAAC code to rand-isaac.c.Paul Eggert
(fillrand, main): Adjust to the fact that the state size is now runtime-configurable.
2005-09-24Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H', for consistency with ↵Jim Meyering
gnulib.
2005-07-11(wipefile): Always use binary mode. Clearly thisPaul Eggert
never worked right on DOS!
2005-07-03Include fcntl--.h, not unistd-safer.h.Paul Eggert
(wipename, wipe_file): Don't use fd_safer; no longer needed now that we include fcntl--.h.
2005-06-19(usage): Use `file system', not `filesystem'.Jim Meyering
2005-06-17(usage): Clarify that shred works on an ext3 fileJim Meyering
system as long as it's not in data=journal mode. Tiny change by Mark Melahn.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-11Include unistd-safer.h.Paul Eggert
(wipename): Use fd_safer on directory file descriptor. (wipefile): Remove special case for /dev/fd/* on older hosts. It didn't work in general, and wasn't documented. Use fd_safer.
2005-04-09Remove all uses of signals; modern hosts havePaul Eggert
/dev/random and don't need this gorp. Do not include signal.h. (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
2005-03-06Remove register keyword.Jim Meyering
2005-02-21Include gethrxtime.h.Paul Eggert
(isaac_seed): Use gethrxtime rather than a mishmash.
2005-01-15(isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,Jim Meyering
because just calling gethrtime evokes an `illegal instruction' failure when compiled with Sun's c89 on Solaris 8 and 9.
2005-01-15(isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEEDJim Meyering
twice with the same value of `t'. Replace nested #if-#else blocks with #if-#elif-#elif chain.
2004-09-21Remove unused "case 0".Paul Eggert
2004-08-10(usage): "-" is an operand, not an option.Paul Eggert
2004-08-09(wipename): Work even if the directory is writeablePaul Eggert
and not readable. Prefer write access, since this should work better with fdatasync.
2004-08-03(struct Options, main): Use bool for booleans.Paul Eggert
(isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2004-08-02(UINT_MAX_32_BITS): Remove.Paul Eggert
(word32): Remove. All uses changed to uint32_t. (isaac_seed_data): Remove unnecessary cast.
2004-06-30(usage, main): Output "file system" rather than "filesystem".Jim Meyering
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-06-08(direct_mode): Turn it on/off with directio, too.Jim Meyering
2004-06-07Enable direct-mode I/O (bypassing the buffer cache), if possible.Jim Meyering
Prompted by a suggestion from Kalle Olavi Niemitalo in http://bugs.debian.org/207035. (direct_mode): New function. (do_wipefd): Turn on direct-mode I/O. (dopass): If a file's first write fails with EINVAL, turn off direct-mode I/O and retry the write.
2004-06-04(dopass): Don't subtract 1 from the offset afterJim Meyering
a write error. Problem reported by Jon Peatfield in: http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
2004-05-30(dosync): Ignore EBADF errors, as IRIX 6.5Jim Meyering
fdatasync reports EBADF when syncing (unwritable) directories. Problem reported by Albert Chin-A-Young in: http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
2004-05-20Use translatable diagnostics, e.g.Jim Meyering
change "%s: remove" to _("%s: failed to remove") and change "%s: close" to _("%s: failed to close").
2004-05-18(names): Bring back lower-case letters, "_", andJim Meyering
".". But continue to omit +, =, %, @, #, as they're either shell metacharacters (for some shells) or are not in some character sets, or (in the case of '%') must be a metacharacter somewhere.
2004-05-17(incname): Decrement `len' only once per loop iteration.Jim Meyering
2004-05-16In shred, check for errors from fdatasync more carefully. IfJim Meyering
fdatasync fails with errno==EINVAL, it means this implementation does not support synchronized I/O for this file. Do not report this as an error, as (for example) AIX 5.2 fdatasync reports it for raw disk devices. Problem reported by Albert Chin in <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>. Check for write errors, though: the old code ignored them. Improve error checking in a few other cases, too (e.g., close of a directory). Also, change several 'int' values to 'bool', so that the error checking is a bit clearer. Similarly, change unsigned values to size_t where appropriate. * src/shred.c: Include "dirname.h". (datasync) [!HAVE_FDATASYNC]: Remove. (dosync): New function. (dopass): Use it. Return 1 on write error, -1 on other error. All callers changed. Report write error if dosync does. (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false), not int (0/-1). All callers changed. Return false if there's a write error. (incname): Return bool (true/false), not int (0/1). Accept size_t length, not unsigned. All callers changed. Do not bother checking for non-digits; it can't happen. Replace recursion with iteration. (wipename): Use dir_name, base_name, etc. instead of assuming Unix file names. Use size_t for length, not unsigned. Report error if unlink or close fails. (wipename, main): Use bool for booleans. (names): Use only digits and uppercase letters, for greater portability.
2004-05-06(do_wipefd): Use xnmalloc, rather than xmalloc.Jim Meyering
2004-04-20(sigill_handler, isaac_seed_machdep): Use void, not (obsolete) RETSIGTYPE.Jim Meyering
2004-04-19(isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:Jim Meyering
Initialize a buffer to avoid warnings from tools like valgrind.
2004-04-15Include getpagesize.h.Jim Meyering
(dopass): Align I/O buffers to page boundaries.
2004-04-08(O_NOCTTY): Remove redundant decl.Jim Meyering
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(main): Don't assume EXIT_FAILURE == 1, as POSIX doesn't require it.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.