Skip to content

Commit

Permalink
unveil write only and edit fwrite error
Browse files Browse the repository at this point in the history
  • Loading branch information
basepr1me committed Mar 24, 2022
1 parent 015cf88 commit 7c124f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shreddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit 7c124f7

Please sign in to comment.