diff options
author | Xin LI <delphij@FreeBSD.org> | 2019-12-08 01:20:37 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2019-12-08 01:20:37 +0000 |
commit | 2780a26b6a306506ca521988799b5fa1cd5ce6c7 (patch) | |
tree | 44d416dad4b43d4598c7d16c0b6a09e3f7776133 /sbin | |
parent | c3cccf95bfe61a9237e8ea7ea64b81a666378205 (diff) | |
download | src-test2-2780a26b6a306506ca521988799b5fa1cd5ce6c7.tar.gz src-test2-2780a26b6a306506ca521988799b5fa1cd5ce6c7.zip |
Notes
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/newfs_msdos/mkfs_msdos.c | 8 | ||||
-rw-r--r-- | sbin/newfs_msdos/newfs_msdos.c | 3 |
2 files changed, 4 insertions, 7 deletions
diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c index 0a8b931645b8..ac95db66cc91 100644 --- a/sbin/newfs_msdos/mkfs_msdos.c +++ b/sbin/newfs_msdos/mkfs_msdos.c @@ -318,7 +318,8 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op) bpb.bpbHiddenSecs = o.hidden_sectors; if (!(o.floppy || (o.drive_heads && o.sectors_per_track && o.bytes_per_sector && o.size && o.hidden_sectors_set))) { - getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb); + if (getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb) == -1) + goto done; bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec); if (bpb.bpbSecPerClust == 0) { /* set defaults */ if (bpb.bpbHugeSectors <= 6000) /* about 3MB -> 512 bytes */ @@ -423,10 +424,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op) bname = o.bootstrap; if (!strchr(bname, '/')) { snprintf(buf, sizeof(buf), "/boot/%s", bname); - if (!(bname = strdup(buf))) { - warn(NULL); - goto done; - } + bname = buf; } if ((fd1 = open(bname, O_RDONLY)) == -1 || fstat(fd1, &sb)) { warn("%s", bname); diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index 36aa4feaaada..c299a1472fa2 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -185,8 +185,7 @@ main(int argc, char *argv[]) fname = *argv++; if (!o.create_size && !strchr(fname, '/')) { snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname); - if (!(fname = strdup(buf))) - err(1, NULL); + fname = buf; } dtype = *argv; exit(!!mkfs_msdos(fname, dtype, &o)); |