summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-13 22:38:52 +0000
committerMiles Bader <miles@gnu.org>1995-04-13 22:38:52 +0000
commit5d0490f7a88ac00a1f1d44e400cf9a7106168222 (patch)
tree841c2ec06a291c5c19c8f82b064c2d8a0993d044
parentaea32c3dbee4480afc60295b10252faec4eebd47 (diff)
(main): Don't abort if a std file descriptor is already open.
-rw-r--r--ufs/main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ufs/main.c b/ufs/main.c
index 5905cbb0..772f82ff 100644
--- a/ufs/main.c
+++ b/ufs/main.c
@@ -109,11 +109,10 @@ main (int argc, char **argv)
{
/* XXX let us see errors */
int fd = open ("/dev/console", O_RDWR);
- assert (fd == 0);
- fd = dup (0);
- assert (fd == 1);
- fd = dup (1);
- assert (fd == 2);
+ while (fd >= 0 && fd < 2)
+ fd = dup(fd);
+ if (fd > 2)
+ close (fd);
}
}
else