summaryrefslogtreecommitdiffstats
path: root/lib/libufs/sblock.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2003-01-23 23:58:22 +0000
committerjmallett <jmallett@FreeBSD.org>2003-01-23 23:58:22 +0000
commitdd2fdc87043e462457687a0e485955ec60bc9cc0 (patch)
tree4e162ee2af7bd49387fb9d2d0c27944184996015 /lib/libufs/sblock.c
parent33478b2ceb878dac5d2cf77dde41aee4bb219554 (diff)
downloadFreeBSD-src-dd2fdc87043e462457687a0e485955ec60bc9cc0.zip
FreeBSD-src-dd2fdc87043e462457687a0e485955ec60bc9cc0.tar.gz
bwrite, not sbwrite, needs to open for writing and write.
Diffstat (limited to 'lib/libufs/sblock.c')
-rw-r--r--lib/libufs/sblock.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/libufs/sblock.c b/lib/libufs/sblock.c
index ef6c9de..d769edb 100644
--- a/lib/libufs/sblock.c
+++ b/lib/libufs/sblock.c
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
#include <ufs/ffs/fs.h>
#include <errno.h>
-#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -94,18 +93,12 @@ int
sbwrite(struct uufsd *disk, int all)
{
struct fs *fs;
- int i, rofd;
+ int i;
ERROR(disk, NULL);
fs = &disk->d_fs;
- rofd = disk->d_fd;
- disk->d_fd = open(disk->d_name, O_WRONLY);
- if (disk->d_fd < 0) {
- ERROR(disk, "failed to open disk");
- return -1;
- }
if (bwrite(disk, disk->d_sblock, fs, SBLOCKSIZE) == -1) {
ERROR(disk, "failed to write superblock");
return -1;
@@ -118,7 +111,5 @@ sbwrite(struct uufsd *disk, int all)
return -1;
}
}
- close(disk->d_fd);
- disk->d_fd = rofd;
return 0;
}
OpenPOWER on IntegriCloud