summaryrefslogtreecommitdiff
path: root/src/shred.c
AgeCommit message (Collapse)Author
2009-01-22shred: change default number of overwrites from 25 to 3Pádraig Brady
* src/shred.c: The concensus is that a default of 3 passes is appropriate for current drive technologies. * src/TODO: Reference Paul Eggert's suggestion of enhancing shred to conform to DoD 5220 rules.
2009-01-16shred: avoid -Wsign-compare warningsPádraig Brady
* src/shred.c: Use already assigned signed variable sizeof_r, rather than the unsigned sizeof(r). Don't use signed integer overflow check that contemporary compilers may remove anyway.
2008-12-01avoid warnings about initialization of automatic aggregatesJim Meyering
* src/system.h (DZA_CONCAT0, DZA_CONCAT): New macros. (DECLARE_ZEROED_AGGREGATE): New macro. * src/ls.c (quote_name): Use it. * src/pathchk.c (portable_chars_only): Use it. * src/shred.c (main): Use it. * src/stty.c (main): Use it. * src/wc.c (SUPPORT_OLD_MBRTOWC): Use it.
2008-09-19shred --help: lowercase a stray capitalBenno Schulenberg
2008-08-04doc: correct and normalize --help output of several toolsBenno Schulenberg
* src/chroot.c (usage): Add "[ARG]" to synopsis. * src/cut.c (usage): Remove an inconsistent period in an option description. * src/du.c (usage): Remove superfluous argument after short option -X. Also remove inconsistent uppercase and final period. Use a single indent level for prettiness. * src/shred.c (usage): Normalize the synopsis. * src/stty.c (usage): Options -F and --file are alternatives, cannot both be used. * src/sum.c (usage): -r does not overrule -s; the last one counts. * src/uptime.c (usage): Remove inconsistent space from the synopsis. * src/users.c: Likewise.
2008-06-27factor out time_t-to-string conversion idiomJim Meyering
* src/system.h: Include "inttostr.h". (timetostr): New function, factored out of... * src/date.c (show_date): Use timetostr. * src/du.c (show_date): Likewise. * src/ls.c (print_long_format): Likewise. * src/pinky.c (time_string): Likewise. * src/stat.c (human_time): Likewise. * src/*.c: Don't include inttostr.h, since system.h does. * src/c99-to-c89.diff: Adjust offsets.
2008-06-26shred: also ignore EISDIR upon failed fsync/fdatasync on HP-UXJim Meyering
* src/shred.c (ignorable_sync_errno): New function. (dosync): Use it. Based on a patch from Peter O'Gorman.
2008-06-16remove redundant const directivesJim Meyering
In 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c, I added some missing "const" directives, as well as some new, redundant ones. This removes the redundant ones. Pointed out by Eric Blake. * base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c: * cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c: * env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c: * install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c: * mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c: * paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c: * rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c: * stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c: * touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c: * wc.c, who.c: Remove redundant const directives. * maint.mk (sc_const_long_option): Don't require redundant "const".
2008-06-14add "const" attribute, where possibleJim Meyering
* maint.mk (sc_const_long_option): New rule. Enforce global change. * src/base64.c (long_options): Use "const" where possible. * src/cat.c (main): Likewise. * src/chcon.c (long_options): Likewise. * src/chgrp.c (long_options): Likewise. * src/chmod.c (long_options): Likewise. * src/chown.c (long_options): Likewise. * src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise. * src/cp.c (long_opts): Likewise. * src/csplit.c (longopts): Likewise. * src/cut.c (longopts): Likewise. * src/date.c (long_options): Likewise. * src/dd.c (conversions, flags, statuses): Likewise. * src/df.c (long_options): Likewise. * src/dircolors.c (long_options): Likewise. * src/du.c (long_options): Likewise. * src/env.c (longopts): Likewise. * src/expand.c (longopts): Likewise. * src/fmt.c (long_options): Likewise. * src/fold.c (longopts): Likewise. * src/groups.c (longopts): Likewise. * src/head.c (long_options): Likewise. * src/id.c (longopts): Likewise. * src/install.c (long_options): Likewise. * src/join.c (longopts): Likewise. * src/kill.c (long_options): Likewise. * src/ln.c (long_options): Likewise. * src/ls.c (long_time_format, long_options, sort_functions): Likewise. * src/md5sum.c (long_options): Likewise. * src/mkdir.c (longopts): Likewise. * src/mkfifo.c (longopts): Likewise. * src/mknod.c (longopts): Likewise. * src/mktemp.c (longopts): Likewise. * src/mv.c (long_options): Likewise. * src/nice.c (longopts): Likewise. * src/nl.c (longopts): Likewise. * src/od.c (charname, long_options): Likewise. * src/paste.c (longopts): Likewise. * src/pathchk.c (longopts): Likewise. * src/pinky.c (longopts): Likewise. * src/pr.c (long_options): Likewise. * src/ptx.c (long_options): Likewise. * src/readlink.c (longopts): Likewise. * src/rm.c (long_opts): Likewise. * src/rmdir.c (longopts): Likewise. * src/runcon.c (long_options): Likewise. * src/seq.c (long_options): Likewise. * src/shred.c (long_opts): Likewise. * src/shuf.c (long_opts): Likewise. * src/sort.c (monthtab, long_options): Likewise. * src/split.c (longopts): Likewise. * src/stat.c (long_options): Likewise. * src/stty.c (mode_info, control_info, longopts, set_mode) Likewise. (set_control_char, speeds): Likewise. * src/su.c (longopts): Likewise. * src/sum.c (longopts): Likewise. * src/tac.c (longopts): Likewise. * src/tail.c (long_options): Likewise. * src/tee.c (long_options): Likewise. * src/timeout.c (long_options): Likewise. * src/touch.c (longopts): Likewise. * src/tr.c (long_options): Likewise. * src/truncate.c (longopts): Likewise. * src/tty.c (longopts): Likewise. * src/uname.c (uname_long_options, arch_long_options): Likewise. * src/unexpand.c (longopts): Likewise. * src/uniq.c (longopts): Likewise. * src/wc.c (longopts): Likewise. * src/who.c (longopts): Likewise.
2008-06-03use gnulib's progname moduleJim Meyering
* bootstrap.conf (gnulib_modules): Add progname. * src/*.c (program_name): Remove declaration. * (main): Call set_program_name rather than setting program_name. * src/nice.c (main): Cast program_name to "(char *)". * src/prog-fprintf.c: Include "system.h" * src/system.h: Include "progname.h". * maint.mk (sc_program_name): Adjust rule. Suggestion from Eric Blake.
2008-05-26adjust copyright datesJim Meyering
2008-05-26convert single-author programs to use proper_nameJim Meyering
g grep -E -l 'define AUTHORS "[^,]+"$'|xargs perl -pi -e \ 's/(define AUTHORS) ("[^,]+")$/$1 proper_name ($2)/'
2007-12-04Reflect change in gnulib: don't include getpagesize.h,Jim Meyering
now that it's provided by unistd.h. * src/cat.c: Don't include getpagesize.h. * src/copy.c: Likewise. * src/dd.c: Likewise. * src/shred.c: Likewise. * src/split.c: Likewise.
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-06-15Don't include "quote.h" when it is not used.Jim Meyering
* src/md5sum.c: Remove unnecessary inclusion of "quote.h". * src/expr.c: Likewise. * src/shred.c: Likewise. * Makefile.maint (sc_prohibit_quote_without_use): New rule. * src/c99-to-c89.diff: Adjust offsets.
2007-03-28Help translators include translation team's web or email address.Jim Meyering
* src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
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.