From 68ebd51c62f0c962ecddbb6cf1f86e26d4be2f98 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 28 Feb 2026 15:10:48 +0100 Subject: m fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- README | 6 +++--- deadshred.1 | 4 ++-- deadshred.c | 9 +++++---- map.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README b/README index f0471dd..d0c26dc 100644 --- a/README +++ b/README @@ -55,9 +55,9 @@ OPERANDS becomes empty. STDIN - Unless the standard input is a terminal device, it shall be an - unless source of either random data or a particular byte to - fill the device with. + Unless the standard input is a terminal device, it shall be a + source of either random data or a particular byte to fill the + device with. NOTES While the deadshred utility is designed for block devices, it diff --git a/deadshred.1 b/deadshred.1 index 7e8b5c2..d4f9a11 100644 --- a/deadshred.1 +++ b/deadshred.1 @@ -116,8 +116,8 @@ successfully overwritten. This file will be unlinked when it becomes empty. .SH STDIN -Unless the standard input is a terminal device, it shall be an -unless source of either random data or a particular byte to +Unless the standard input is a terminal device, it shall +be source of either random data or a particular byte to fill the device with. .SH STDOUT diff --git a/deadshred.c b/deadshred.c index baa7bf6..915d168 100644 --- a/deadshred.c +++ b/deadshred.c @@ -33,8 +33,8 @@ static int auxthread_pipe[2]; static void print_status(int done, struct status *s) { - static char buf1[2048] = {0}; - static char buf2[2048] = {0}; + static char buf1[2560] = {0}; + static char buf2[2560] = {0}; static int bufi = 0; char subbuf1[256]; @@ -255,7 +255,7 @@ shredspan(int fd, struct span *span, const char *fname, int have_map) if (r >= 0) { status_off += (size_t)r; goto write_status_again; - } else if (r == EINTR) { + } else if (errno == EINTR) { if (exiting) { status.nspans = saved_nspans; goto userexit; @@ -455,7 +455,7 @@ main(int argc, char *argv[]) eprintf("open %s O_RDWR|O_CREAT 0666:", argv[1]); if (lseek(map_fd, 0, SEEK_SET)) eprintf("lseek %s 0 SEEK_SET:", argv[1]); - status.shredded = load_map(fd, &status, status.direction, argv[1]); + status.shredded = load_map(map_fd, &status, status.direction, argv[1]); } if (pipe(auxthread_pipe)) @@ -526,5 +526,6 @@ out: if (unlink(argv[1])) weprintf("unlink %s:", argv[1]); } + free(status.spans); return 0; } diff --git a/map.c b/map.c index e72b02a..ea828c2 100644 --- a/map.c +++ b/map.c @@ -211,12 +211,12 @@ load_map(int fd, struct status *status, enum direction direction, const char *fn off = 0; } - if (!ended) - eprintf("%s: truncated file content", fname); - if (empty) return 0; + if (!ended) + eprintf("%s: truncated file content", fname); + qsort(status->spans, status->nspans, sizeof(*status->spans), &spancmp); min_start = -1; preshredded = refspan.end - refspan.start; -- cgit v1.2.3-70-g09d2