commit 7c124f72cd02e464744bc2a37482328cd239b56a from: Tracey Emery date: Thu Mar 24 22:30:20 2022 UTC unveil write only and edit fwrite error commit - 015cf88c119f8ae946b9e67a190068c02fd4cf1a commit + 7c124f72cd02e464744bc2a37482328cd239b56a blob - dd47e956bbf23711f83c825a59582f4ab1389c2c blob + 2cedfc9a96f3de484aa1b3bbab66a3d174c46465 --- shreddisk.c +++ shreddisk.c @@ -164,7 +164,7 @@ main(void) if (pledge("stdio unveil", NULL) == -1) err(1, "pledge"); - if (unveil(realdev, "rw") != 0) + if (unveil(realdev, "w") != 0) err(1, "unveil"); /* disable the cursor */ @@ -198,7 +198,7 @@ main(void) } written = fwrite(&rnum, BYTES, 1, dd); if (written != 1 && sizeof(rnum) != written * BYTES) - err(1, "fwrite"); + break; total += (written * BYTES); now = seconds; @@ -243,7 +243,7 @@ main(void) sh_time = time(NULL); if (round(percent) < 100) - printf("\n\nDisk appears to have been removed."); + printf("\n\nDisk removed or a write error occurred."); printf("\n\nFinished shredding %s\n", ctime(&sh_time));