In the sbwrite(3) function, ensure that the file descriptor has been

upgraded to writable.

Reported by: Kyle Evans <kevans@freebsd.org>
This commit is contained in:
mckusick 2018-02-02 22:06:15 +00:00
parent 144a3ee3a5
commit 4bca618fac

View File

@ -96,9 +96,16 @@ int
sbwrite(struct uufsd *disk, int all)
{
struct fs *fs;
int rv;
ERROR(disk, NULL);
rv = ufs_disk_write(disk);
if (rv == -1) {
ERROR(disk, "failed to open disk for writing");
return (-1);
}
fs = &disk->d_fs;
if ((errno = sbput(disk->d_fd, fs, all ? fs->fs_ncg : 0)) != 0) {
switch (errno) {