diff options
author | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-03-03 22:14:23 +0000 |
---|---|---|
committer | Eric van Gyzen <vangyzen@FreeBSD.org> | 2020-03-03 22:14:23 +0000 |
commit | 7bef70737b71b2c5e34a55e819b0589a62a4dceb (patch) | |
tree | 923a87c747cc4fd9dcd258b6ac7ae2daa56f5664 | |
parent | 1b8b041ce9768a3c4ddaf0895957e11416ad0a7e (diff) | |
download | src-7bef70737b71b2c5e34a55e819b0589a62a4dceb.tar.gz src-7bef70737b71b2c5e34a55e819b0589a62a4dceb.zip |
dumpon: skip size check if using zstd
As with gzip, let the dump device be smaller than physical memory
when using zstd and full dumps.
Also print the error message if the size check fails, even if -v
is not specified. Failing silently is not friendly.
Reviewed by: cem markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23923
Notes
Notes:
svn path=/head/; revision=358594
-rw-r--r-- | sbin/dumpon/dumpon.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c index e1d8bd57b9dc..d705193d2418 100644 --- a/sbin/dumpon/dumpon.c +++ b/sbin/dumpon/dumpon.c @@ -203,11 +203,8 @@ check_size(int fd, const char *fn) err(EX_OSERR, "can't get memory size"); if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) != 0) err(EX_OSERR, "%s: can't get size", fn); - if ((uintmax_t)mediasize < (uintmax_t)physmem) { - if (verbose) - printf("%s is smaller than physical memory\n", fn); - exit(EX_IOERR); - } + if ((uintmax_t)mediasize < (uintmax_t)physmem) + errx(EX_IOERR, "%s is smaller than physical memory", fn); } #ifdef HAVE_CRYPTO @@ -495,7 +492,7 @@ main(int argc, char *argv[]) usage(); fd = opendumpdev(dev, dumpdev); - if (!netdump && !gzip && !rflag) + if (!netdump && !gzip && !zstd && !rflag) check_size(fd, dumpdev); kdap = &ndconf; |