diff options
Diffstat (limited to 'lib/libc/gen/disklabel.c')
-rw-r--r-- | lib/libc/gen/disklabel.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c index 8780573..bd15a47 100644 --- a/lib/libc/gen/disklabel.c +++ b/lib/libc/gen/disklabel.c @@ -85,13 +85,10 @@ getdiskbyname(const char *name) cq++, cp++; *cq = '\0'; - if (cgetstr(buf, "ty", &cq) > 0) { - if (strcmp(cq, "removable") == 0) - dp->d_flags |= D_REMOVABLE; - else if (cq && strcmp(cq, "simulated") == 0) - dp->d_flags |= D_RAMDISK; - free(cq); - } + if (cgetstr(buf, "ty", &cq) > 0 && strcmp(cq, "removable") == 0) + dp->d_flags |= D_REMOVABLE; + else if (cq && strcmp(cq, "simulated") == 0) + dp->d_flags |= D_RAMDISK; if (cgetcap(buf, "sf", ':') != NULL) dp->d_flags |= D_BADSECT; @@ -103,10 +100,9 @@ getdiskbyname(const char *name) getnumdflt(dp->d_nsectors, "ns", 0); getnumdflt(dp->d_ncylinders, "nc", 0); - if (cgetstr(buf, "dt", &cq) > 0) { + if (cgetstr(buf, "dt", &cq) > 0) dp->d_type = gettype(cq, dktypenames); - free(cq); - } else + else getnumdflt(dp->d_type, "dt", 0); getnumdflt(dp->d_secpercyl, "sc", dp->d_nsectors * dp->d_ntracks); getnumdflt(dp->d_secperunit, "su", dp->d_secpercyl * dp->d_ncylinders); @@ -144,11 +140,8 @@ getdiskbyname(const char *name) pp->p_frag = 8; } getnumdflt(pp->p_fstype, ptype, 0); - if (pp->p_fstype == 0) - if (cgetstr(buf, ptype, &cq) >= 0) { - pp->p_fstype = gettype(cq, fstypenames); - free(cq); - } + if (pp->p_fstype == 0 && cgetstr(buf, ptype, &cq) > 0) + pp->p_fstype = gettype(cq, fstypenames); max = p; } } |