diff options
author | Miles Bader <miles@gnu.org> | 1995-04-13 22:38:52 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-04-13 22:38:52 +0000 |
commit | 358d5da97c37c814af4124e099fb50e2189c6d1f (patch) | |
tree | c65cac5d30ed49650456d89f1dbf0c16ce475531 /ufs | |
parent | 6a334458e5ede3990d8bee7ce391dea0c1523753 (diff) |
(main): Don't abort if a std file descriptor is already open.
Diffstat (limited to 'ufs')
-rw-r--r-- | ufs/main.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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 |