diff options
author | 2009-04-30 00:45:00 +0000 | |
---|---|---|
committer | 2009-04-30 00:45:00 +0000 | |
commit | 2b7ecb54d16f42c64cb53f97eba20672e23f4cf0 (patch) | |
tree | 0ace5fddb7de22f7feb48ced7c2e6f779c516df3 /sbin | |
parent | if the kernel is a -current kernel, change the default path to snapshots (diff) | |
download | wireguard-openbsd-2b7ecb54d16f42c64cb53f97eba20672e23f4cf0.tar.xz wireguard-openbsd-2b7ecb54d16f42c64cb53f97eba20672e23f4cf0.zip |
Prime mountpoint info with any fstab info that is available, with
or without the '-f' option being present. Now you can see in Editor
mode or 'disklabel <dev>' where the partitions that exist will be
mounted in the current configuration.
Tweaks (and libc fixes) from, and ok deraadt@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/disklabel/disklabel.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 7b6ca373533..36eabd82977 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.152 2009/04/30 00:45:00 krw Exp $ */ /* * Copyright (c) 1987, 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 krw Exp $"; +static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.152 2009/04/30 00:45:00 krw Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -62,6 +62,7 @@ static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 k #include <stdlib.h> #include <unistd.h> #include <util.h> +#include <fstab.h> #include "pathnames.h" #include "extern.h" @@ -139,9 +140,11 @@ u_int64_t getnum(char *, u_int64_t, u_int64_t, const char **); int main(int argc, char *argv[]) { - int ch, f, writeable, error = 0; + int ch, f, i, writeable, error = 0; struct disklabel *lp; + struct fstab *fsent; FILE *t; + char *partname; while ((ch = getopt(argc, argv, "ABEf:NRWb:cdenp:s:tvw")) != -1) switch (ch) { @@ -241,6 +244,17 @@ main(int argc, char *argv[]) if (f < 0) err(4, "%s", specname); + asprintf(&partname, "/dev/%s%c", dkname, 'a'); + setfsent(); + for (i = 0; i < MAXPARTITIONS; i++) { + partname[strlen(dkname)+5] = 'a'+i; + fsent = getfsspec(partname); + if (fsent) + mountpoints[i] = strdup(fsent->fs_file); + } + endfsent(); + free(partname); + #ifdef DOSLABEL /* * Check for presence of DOS partition table in |