git: 2b20327ec939 - main - dumpon: proceed without compression if the kernel lacks support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Mar 2022 16:09:14 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=2b20327ec9394754c0bac2d83567b972a08e3930
commit 2b20327ec9394754c0bac2d83567b972a08e3930
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-03-10 18:04:34 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-03-16 16:08:28 +0000
dumpon: proceed without compression if the kernel lacks support
PR: 252554
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34520
---
sbin/dumpon/dumpon.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sbin/dumpon/dumpon.c b/sbin/dumpon/dumpon.c
index a11f07a01200..7d8f81d5eaaf 100644
--- a/sbin/dumpon/dumpon.c
+++ b/sbin/dumpon/dumpon.c
@@ -650,6 +650,15 @@ main(int argc, char *argv[])
error = ioctl(fd, DIOCSKERNELDUMP, kdap);
if (error != 0)
error = errno;
+ if (error == EINVAL && (gzip || zstd)) {
+ /* Retry without compression in case kernel lacks support. */
+ kdap->kda_compression = KERNELDUMP_COMP_NONE;
+ error = ioctl(fd, DIOCSKERNELDUMP, kdap);
+ if (error == 0)
+ warnx("Compression disabled; kernel may lack gzip or zstd support.");
+ else
+ error = errno;
+ }
explicit_bzero(kdap->kda_encryptedkey, kdap->kda_encryptedkeysize);
free(kdap->kda_encryptedkey);
explicit_bzero(kdap, sizeof(*kdap));