Index: head/sbin/newfs_msdos/mkfs_msdos.c =================================================================== --- head/sbin/newfs_msdos/mkfs_msdos.c +++ head/sbin/newfs_msdos/mkfs_msdos.c @@ -318,7 +318,8 @@ 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 @@ 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); Index: head/sbin/newfs_msdos/newfs_msdos.c =================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c +++ head/sbin/newfs_msdos/newfs_msdos.c @@ -185,8 +185,7 @@ 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));