aboutsummaryrefslogtreecommitdiff
path: root/lib/libufs/type.c
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2003-03-28 01:50:11 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2003-03-28 01:50:11 +0000
commit7a51271b681096b1477621a3aef82b0a8322396f (patch)
tree49af08275ee3e083f09783cfa49eaa296b98ec82 /lib/libufs/type.c
parentc67c1ce843e9fa5e8a70401b048e2b85a3530868 (diff)
downloadsrc-7a51271b681096b1477621a3aef82b0a8322396f.tar.gz
src-7a51271b681096b1477621a3aef82b0a8322396f.zip
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.
Notes
Notes: svn path=/head/; revision=112730
Diffstat (limited to 'lib/libufs/type.c')
-rw-r--r--lib/libufs/type.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libufs/type.c b/lib/libufs/type.c
index e5cb06245572..3d65167b2c53 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;
}