summaryrefslogtreecommitdiff
path: root/sbin/dump
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-04-07 04:52:20 +0000
committerchristos <christos@NetBSD.org>2012-04-07 04:52:20 +0000
commit4b41a04ca79c8327ed09eec4dca46abc52aa21d8 (patch)
treef0ee8e270b207cb1037fe0dcbd6eb29273f271d2 /sbin/dump
parent6f7524152bf52d8f0036fc79b625b4033e385cc3 (diff)
use getfsspecname()
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/Makefile4
-rw-r--r--sbin/dump/main.c16
-rw-r--r--sbin/dump/optr.c13
3 files changed, 23 insertions, 10 deletions
diff --git a/sbin/dump/Makefile b/sbin/dump/Makefile
index ac47d8cad38..911eb3446f9 100644
--- a/sbin/dump/Makefile
+++ b/sbin/dump/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2011/06/20 07:43:59 mrg Exp $
+# $NetBSD: Makefile,v 1.38 2012/04/07 04:52:20 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# dump.h header file
@@ -32,6 +32,8 @@ SRCS= itime.c main.c optr.c dumprmt.c rcache.c snapshot.c tape.c \
traverse.c unctime.c ffs_inode.c ffs_bswap.c
MAN= dump.8
MLINKS+=dump.8 rdump.8
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
.PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 9ec57a99090..68eeafffb74 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.67 2012/02/19 19:49:20 christos Exp $ */
+/* $NetBSD: main.c,v 1.68 2012/04/07 04:52:20 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: main.c,v 1.67 2012/02/19 19:49:20 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.68 2012/04/07 04:52:20 christos Exp $");
#endif
#endif /* not lint */
@@ -65,6 +65,7 @@ __RCSID("$NetBSD: main.c,v 1.67 2012/02/19 19:49:20 christos Exp $");
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <util.h>
#include "dump.h"
#include "pathnames.h"
@@ -85,7 +86,6 @@ int readblksize = 32 * 1024; /* read block size */
char default_time_string[] = "%T %Z"; /* default timestamp string */
char *time_string = default_time_string; /* timestamp string */
-int main(int, char *[]);
static long numarg(const char *, long, long);
static void obsolete(int *, char **[]);
static void usage(void);
@@ -108,6 +108,7 @@ main(int argc, char *argv[])
char *mountpoint;
int just_estimate = 0;
char labelstr[LBLSIZE];
+ char buf[MAXPATHLEN];
char *new_time_format;
char *snap_backup = NULL;
@@ -294,7 +295,10 @@ main(int argc, char *argv[])
break;
}
if ((dt = fstabsearch(argv[i])) != NULL) {
- disk = dt->fs_spec;
+ if (getfsspecname(buf, sizeof(buf), dt->fs_spec)
+ == NULL)
+ quit("%s (%s)", buf, strerror(errno));
+ disk = buf;
mountpoint = xstrdup(dt->fs_file);
goto multicheck;
}
@@ -402,7 +406,9 @@ main(int argc, char *argv[])
mountpoint = NULL;
mntinfo = mntinfosearch(disk);
if ((dt = fstabsearch(disk)) != NULL) {
- disk = rawname(dt->fs_spec);
+ if (getfsspecname(buf, sizeof(buf), dt->fs_spec) == NULL)
+ quit("%s (%s)", buf, strerror(errno));
+ disk = rawname(buf);
mountpoint = dt->fs_file;
msg("Found %s on %s in %s\n", disk, mountpoint, _PATH_FSTAB);
} else if (mntinfo != NULL) {
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c
index b11f47467b7..69000d1103d 100644
--- a/sbin/dump/optr.c
+++ b/sbin/dump/optr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: optr.c,v 1.36 2006/12/18 20:07:32 christos Exp $ */
+/* $NetBSD: optr.c,v 1.37 2012/04/07 04:52:20 christos Exp $ */
/*-
* Copyright (c) 1980, 1988, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94";
#else
-__RCSID("$NetBSD: optr.c,v 1.36 2006/12/18 20:07:32 christos Exp $");
+__RCSID("$NetBSD: optr.c,v 1.37 2012/04/07 04:52:20 christos Exp $");
#endif
#endif /* not lint */
@@ -56,6 +56,7 @@ __RCSID("$NetBSD: optr.c,v 1.36 2006/12/18 20:07:32 christos Exp $");
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <util.h>
#include <ufs/ufs/dinode.h>
@@ -321,11 +322,15 @@ struct fstab *
allocfsent(struct fstab *fs)
{
struct fstab *new;
+ char buf[MAXPATHLEN];
- new = (struct fstab *)xmalloc(sizeof (*fs));
+ new = xmalloc(sizeof (*fs));
new->fs_file = xstrdup(fs->fs_file);
new->fs_type = xstrdup(fs->fs_type);
- new->fs_spec = xstrdup(fs->fs_spec);
+
+ if (getfsspecname(buf, sizeof(buf), fs->fs_spec) == NULL)
+ msg("%s (%s)", buf, strerror(errno));
+ new->fs_spec = xstrdup(buf);
new->fs_passno = fs->fs_passno;
new->fs_freq = fs->fs_freq;
return (new);