From 491384a2d21d60151cb793357f1d67122e37cc36 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 20 Oct 1994 16:57:52 +0000 Subject: Formerly setup.c.~6~ --- ufs-fsck/setup.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'ufs-fsck') 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"); -- cgit v1.2.3