summaryrefslogtreecommitdiff
path: root/bin/dd
AgeCommit message (Collapse)Author
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-02-16add fsync to STANDARDS;Jason McIntyre
2019-02-16Implement the conv=fsync feature which does an fsync(2) after theAlexander Bluhm
final write to output. GNU dd also has this. It is useful for write performance measurement or guaranteed writes to reliable storage. OK kn@ tedu@ deraadt@
2018-07-25Free operand copies after parsing.cheloha
We strdup operands before destructively parsing them to keep w(1) output looking nice and neat, but after parsing we ought to free them. We do need to keep copies for file paths, though, so add additional strdups for operands if and of. While here, use the preferred err(1, NULL) for an allocation failure. Also while here, don't assign `oper' to a copy of itself because it looks strange. "sure." deraadt
2018-07-23Don't cast malloc(3) size to u_int.cheloha
Large buffer sizes on 64-bit platforms cause the sum to wrap, leading read(2) to fail later. We check prior to this point that all buffer sizes are <= SSIZE_MAX. SSIZE_MAX * 2 < SIZE_MAX on all platforms, so the addition here will not overflow and cause a similar issue. Discovered by tobias@ a while back. ok deraadt millert tobias
2018-04-07snprintf+writev -> dprintfcheloha
Much simpler. Dropping writev makes the output from summary() non-atomic, so output lines triggered by SIGINFO can intermingle with output lines triggered by SIGINT or atexit(3). This behavior is difficult to trigger, even deliberately. The buffer in dprintf is large enough so that lines produced by summary() are not garbled if this occurs, though, so this is unlikely to break any scripts. Discussed at length with deraadt@, who helpfully noted that "not all problems have perfect solutions." ok millert@
2018-01-03Stop "dd if=/dev/zero of=/dev/null bs=1 count=2 skip=0x7fffffffffffffff"Ingo Schwarze
from erroring out with "dd: skip: Undefined error: 0", mostly for consistency and to avoid the unidiomatic, wrong looking code. Patch from Bulat Musin <mbulatka at yandex dot ru>. OK guenther@ millert@
2017-10-24When dd(1) fails because it receives an INT signal,Ingo Schwarze
exit with a non-zero EXIT STATUS, as required by POSIX, consistent with what other operating systems do, consistent with how other OpenBSD programs behave, and making wait(2) consistent with what happens when dd(1) dies from other signals. Patch from <ScottCheloha at gmail dot com>. OK florian@ tb@.
2017-08-13convert gettimeofday to mono clock.Ted Unangst
from Scott Cheloha
2016-08-25remove lint commentsTed Unangst
2016-08-17Add HISTORY section.Ingo Schwarze
Information found on: http://www.tuhs.org/cgi-bin/utree.pl Checked by Sevan Janiyan <venture37 at geeklan dot co dot uk>.
2016-08-16Nuke a bunch of whitespace nits seen while '%q' hunting.Kenneth R Westerback
2016-08-14%qd -> %lld for an off_t already being cast to (long long)!Kenneth R Westerback
2016-08-14replace strtoq with strtoll. ok openbsdTed Unangst
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-04after dd has opened it's files and done the tape positioning ioctl, weTheo de Raadt
can tame "stdio" it. ok semarie
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2015-01-15remove .Tn; from Jan Stary <hans at stare dot cz>Ingo Schwarze
2015-01-05use the correct read count when determining how swabbing is necessary.Ted Unangst
bug report from Martin Wolters
2014-12-11use a local swapbytes function instead of relying on undefinedTed Unangst
overlapping swab behavior. vaguely ok kettenis
2014-09-14Error out when negative values are given for sizes on the command line.Ingo Schwarze
Do not error out when the maximum permissible value is given, but only when it is exceeded. Patch from William Orr <will at worrbase dot com> using feedback from tedu@. ok millert@
2014-05-21Use errc/warnc to simplify code.Philip Guenther
ok jca@ krw@
2014-03-27The "old" conversions are not mandated by any standard and areTed Unangst
underspecified. The man page offers little guidance as to their use. Remove them and spare people the (likely poor) decision to use them. ok deraadt jmc millert
2014-03-24support gigabytes. also update some comments and make goto label nicer.Ted Unangst
ok deraadt jmc
2014-02-14use .At where appropriate; from Jan Stary <hans at stare dot cz>Ingo Schwarze
2014-02-12tweak previous;Jason McIntyre
2014-02-12Add an operand to /bin/dd that suppresses the status lines printedAlexander Bluhm
to stderr after transfer. Use the GNU syntax status=noxfer and status=none to make dd quiet. The output is annoying in some situations, so people redirect stderr to /dev/null. This approach also suppresses the error messages and bugs in shell scripts remain undetected. The new feature status=none is the better alternative. OK mpf@
2014-02-02expand STANDARDS; ok sobradoJason McIntyre
2013-11-11unused prototypeTheo de Raadt
2013-06-01fiddle with the NO_CONV code to allow notrunc and noerror to still work.Ted Unangst
ok halex
2013-06-01consolidate ifdef blocks by moving a variableTed Unangst
2013-04-16handle larger tv_sec typesTheo de Raadt
2012-12-04remove some unnecessary sys/cdefs.h inclusionsTheo de Raadt
2012-07-12Use S_ISFIFO and S_ISSOCK instead of lseek() to determine whetherTodd C. Miller
an fd is a socket, pipe or named pipe. OK deraadt@ matthew@
2011-10-18Support K and M as well as k and m for sizes. From Thomas Pfaff.Nicholas Marriott
ok millert jmc
2010-09-03add an EXIT STATUS section for /bin;Jason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-05-12The conversions ascii, ebcdic and ibm are XPG4, not POSIX.Ingo Schwarze
The size multipliers m and w are BSD extensions, not POSIX. While here, sort the conversions alphabetically. help and OK jmc@, sobrado@; and sthen@ on an earlier version
2009-02-08bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewJason McIntyre
updates to follow;
2008-10-05the ellipsis allow more than one operand being specified.Igor Sobrado
ok jmc@
2007-11-10remove "unused variable" warning appearing when building releaseCharles Longeau
ok millert@
2007-05-31convert to new .Dd format;Jason McIntyre
2007-05-29- consistent STANDARDS blurbJason McIntyre
- note which options are extensions to POSIX discussed w/ deraadt otto millert
2006-11-07It is better to use isatty() to see if a dev is seekable, becauseOtto Moerbeek
skipping blocks on a raw disk device with bad sectors should be possible. Noted by Geoff Steckel; ok tom@ deraadt@
2006-11-07fix skipping when reading from a tty; reported by Karel KulhavyOtto Moerbeek
<clock at twibright dot com>; ok deraadt@
2006-11-01Fix range checking for in.dbsz and out.dbsz.Ray Lai
Add range checking for cbsz. Change type in format string to %zd and cast SSIZE_MAX to ssize_t. Fixes PR 5278 submitted by malaler at gmail dot com. OK otto@ and millert@.
2006-06-01add another exmaple; stolen from a nick holland email...Jason McIntyre
2006-05-31- use .ExJason McIntyre
- standard EXAMPLES
2006-03-22change %u to %zu to correctly print size_tDavid Hill
ok ray@ jaredy@ moritz@
2005-05-27include sys/time.h to get struct timevalTodd C. Miller