diff options
author | jmallett <jmallett@FreeBSD.org> | 2003-03-28 01:50:11 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2003-03-28 01:50:11 +0000 |
commit | 2b3cee5134417f2ebe1bf390715f841f8fc7bb55 (patch) | |
tree | 49af08275ee3e083f09783cfa49eaa296b98ec82 /lib/libufs | |
parent | 53b1373a1fbd6afb2dec787d06a2af4455017eee (diff) | |
download | FreeBSD-src-2b3cee5134417f2ebe1bf390715f841f8fc7bb55.zip FreeBSD-src-2b3cee5134417f2ebe1bf390715f841f8fc7bb55.tar.gz |
Close the disk file descriptor that is RO before trying to open the
new one, and do not fall back to the RO fd. There was a bug here
in that the RO fd was never closed, if the RDRW open succeeded, but
this code is bogus anyway, and it breaks newfs of floppies, at least
for me, due to "Device busy." Anything that wants to fall back is
doing something significantly odd that it should have some more complex
code on its end.
Diffstat (limited to 'lib/libufs')
-rw-r--r-- | lib/libufs/type.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libufs/type.c b/lib/libufs/type.c index e5cb062..3d65167 100644 --- a/lib/libufs/type.c +++ b/lib/libufs/type.c @@ -182,19 +182,16 @@ again: if (stat(name, &st) < 0) { int ufs_disk_write(struct uufsd *disk) { - int rofd; - ERROR(disk, NULL); if (disk->d_mine & MINE_WRITE) return 0; - rofd = disk->d_fd; + close(disk->d_fd); disk->d_fd = open(disk->d_name, O_RDWR); if (disk->d_fd < 0) { ERROR(disk, "failed to open disk for writing"); - disk->d_fd = rofd; return -1; } |