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:
Kirk McKusick 2018-02-02 22:06:15 +00:00
parent 62042c979d
commit 8a9493deb2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328813

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) {