diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-10-20 16:57:52 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-10-20 16:57:52 +0000 |
commit | 436101b13c694b042a7b751278c7325790160db4 (patch) | |
tree | fcdb09afcf6f0747864b99665c60b26047bdf187 /ufs-fsck | |
parent | a228ad7ad2766a016dec2b7c426ac08f29a86035 (diff) |
Formerly setup.c.~6~
Diffstat (limited to 'ufs-fsck')
-rw-r--r-- | ufs-fsck/setup.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/ufs-fsck/setup.c b/ufs-fsck/setup.c index 10521ce1..a4c65bc0 100644 --- a/ufs-fsck/setup.c +++ b/ufs-fsck/setup.c @@ -47,24 +47,27 @@ setup (char *dev) if (!reply ("CONTINUE")) return 0; } - readfd = open (dev, O_RDONLY); - if (readfd == -1) - { - perror (dev); - return 0; - } if (preen == 0) printf ("** %s", dev); - if (nowrite) - writefd = -1; - else - writefd = open (dev, O_WRONLY); - if (nowrite || writefd == -1) + if (!nflag) + readfd = open (dev, O_RDWR); + if (nflag || readfd == -1) { + readfd = open (dev, O_RDONLY); + if (readfd == -1) + { + perror (dev); + return 0; + } + writefd = -1; + nflag = 1; if (preen) pfatal ("NO WRITE ACCESS"); printf (" (NO WRITE)"); } + else + writefd = readfd; + if (preen == 0) printf ("\n"); |