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 | 491384a2d21d60151cb793357f1d67122e37cc36 (patch) | |
tree | 953d2d8134dbcb372ec136a11b90b8dea458615e /ufs-fsck | |
parent | 8bc12dddbd75e0d7fcb5247dffa0f6e0a44bca83 (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"); |