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.
This commit is contained in:
parent
c67c1ce843
commit
7a51271b68
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user