Skip to content

Commit

Permalink
Actually open files to be written for writing :)
Browse files Browse the repository at this point in the history
Linux (correctly) marks a loop device backed by a read-only file as
read-only.
  • Loading branch information
DemiMarie committed Mar 11, 2023
1 parent 581fbc2 commit e9c921e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion not-script/not-script.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int main(int argc, char **argv)
dev_t dev;
uint64_t diskseq;

if ((fd = open(data, O_RDONLY | O_NOCTTY | O_CLOEXEC | O_NONBLOCK)) < 0)
if ((fd = open(data, (writable ? O_RDWR : O_RDONLY) | O_NOCTTY | O_CLOEXEC | O_NONBLOCK)) < 0)
err(1, "open(%s)", data);
char phys_dev[18], hex_diskseq[17];

Expand Down

0 comments on commit e9c921e

Please sign in to comment.