diff options
author | n_hibma <n_hibma@FreeBSD.org> | 1999-10-08 19:54:32 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 1999-10-08 19:54:32 +0000 |
commit | fd59e37cb40478cfb98d3de4e65bd94340178dd5 (patch) | |
tree | abb1c1eea34ca71774c5cf2d01c8b54a7db75a57 | |
parent | cec2d553b623af4cb67d0ae957400b79c3bbc751 (diff) | |
download | FreeBSD-src-fd59e37cb40478cfb98d3de4e65bd94340178dd5.zip FreeBSD-src-fd59e37cb40478cfb98d3de4e65bd94340178dd5.tar.gz |
- Fixed some cases in which mount was segfaulting.
Original patch from Adrian. Martin added a check for free().
- Included the filesystem type in output of mount
PR: bin/13143
Submitted-By: Martin Blapp <mblapp@kassiopeja.lan.attic.ch>
-rw-r--r-- | sbin/mount/mount.c | 22 | ||||
-rw-r--r-- | sbin/mount_ifs/mount.c | 22 |
2 files changed, 24 insertions, 20 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 0cfe742..039ee95 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -490,27 +490,27 @@ prmount(sfp) int flags; struct opt *o; struct passwd *pw; - int f; - (void)printf("%s on %s", sfp->f_mntfromname, sfp->f_mntonname); + (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname, + sfp->f_fstypename); flags = sfp->f_flags & MNT_VISFLAGMASK; - for (f = 0, o = optnames; flags && o->o_opt; o++) + for (o = optnames; flags && o->o_opt; o++) if (flags & o->o_opt) { - (void)printf("%s%s", !f++ ? " (" : ", ", o->o_name); + (void)printf(", %s", o->o_name); flags &= ~o->o_opt; } if (sfp->f_owner) { - (void)printf("%smounted by ", !f++ ? " (" : ", "); + (void)printf(", mounted by "); if ((pw = getpwuid(sfp->f_owner)) != NULL) (void)printf("%s", pw->pw_name); else (void)printf("%d", sfp->f_owner); } if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) - (void)printf("%swrites: sync %ld async %ld", - !f++ ? " (" : ", ", sfp->f_syncwrites, sfp->f_asyncwrites); - (void)printf("%s\n", f ? ")" : ""); + (void)printf(", writes: sync %ld async %ld", + sfp->f_syncwrites, sfp->f_asyncwrites); + (void)printf(")\n"); } struct statfs * @@ -594,7 +594,8 @@ update_options(opts, fstab, curflags) if (opts == NULL) return strdup(""); - fstab = strdup(fstab); + if (fstab == NULL) + fstab = strdup(""); /* remove meta options from list */ remopt(fstab, MOUNT_META_OPTION_FSTAB); @@ -613,7 +614,8 @@ update_options(opts, fstab, curflags) else expopt = catopt(expopt, o); } - free(fstab); + if (fstab == "") + free(fstab); free(cur); free(opts); diff --git a/sbin/mount_ifs/mount.c b/sbin/mount_ifs/mount.c index 0cfe742..039ee95 100644 --- a/sbin/mount_ifs/mount.c +++ b/sbin/mount_ifs/mount.c @@ -490,27 +490,27 @@ prmount(sfp) int flags; struct opt *o; struct passwd *pw; - int f; - (void)printf("%s on %s", sfp->f_mntfromname, sfp->f_mntonname); + (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname, + sfp->f_fstypename); flags = sfp->f_flags & MNT_VISFLAGMASK; - for (f = 0, o = optnames; flags && o->o_opt; o++) + for (o = optnames; flags && o->o_opt; o++) if (flags & o->o_opt) { - (void)printf("%s%s", !f++ ? " (" : ", ", o->o_name); + (void)printf(", %s", o->o_name); flags &= ~o->o_opt; } if (sfp->f_owner) { - (void)printf("%smounted by ", !f++ ? " (" : ", "); + (void)printf(", mounted by "); if ((pw = getpwuid(sfp->f_owner)) != NULL) (void)printf("%s", pw->pw_name); else (void)printf("%d", sfp->f_owner); } if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0) - (void)printf("%swrites: sync %ld async %ld", - !f++ ? " (" : ", ", sfp->f_syncwrites, sfp->f_asyncwrites); - (void)printf("%s\n", f ? ")" : ""); + (void)printf(", writes: sync %ld async %ld", + sfp->f_syncwrites, sfp->f_asyncwrites); + (void)printf(")\n"); } struct statfs * @@ -594,7 +594,8 @@ update_options(opts, fstab, curflags) if (opts == NULL) return strdup(""); - fstab = strdup(fstab); + if (fstab == NULL) + fstab = strdup(""); /* remove meta options from list */ remopt(fstab, MOUNT_META_OPTION_FSTAB); @@ -613,7 +614,8 @@ update_options(opts, fstab, curflags) else expopt = catopt(expopt, o); } - free(fstab); + if (fstab == "") + free(fstab); free(cur); free(opts); |