summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-04-18 15:08:29 +0000
committerimp <imp@FreeBSD.org>2005-04-18 15:08:29 +0000
commitedc45448f9add9761cda49c54639f8719f67a765 (patch)
tree6db51565da80ad469e87f46df76407e9cbc779a5 /sbin/dump
parent9dda468ece28c74f65d5dc313fca317bc0b85a7c (diff)
downloadFreeBSD-src-edc45448f9add9761cda49c54639f8719f67a765.zip
FreeBSD-src-edc45448f9add9761cda49c54639f8719f67a765.tar.gz
'r' disk devices no longer exist, so don't try to create a pathname
that has an 'r' in it. This also eliminates a bogus use of strlcat. PR: 80064
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/main.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index e411802..6af0995 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -659,29 +659,19 @@ sig(int signo)
char *
rawname(char *cp)
{
- static char rawbuf[MAXPATHLEN];
- char *dp;
struct stat sb;
- if (stat(cp, &sb) == 0) {
- /*
- * If the name already refers to a raw device, return
- * it immediately without tampering.
- */
- if ((sb.st_mode & S_IFMT) == S_IFCHR)
- return (cp);
- }
-
- dp = strrchr(cp, '/');
+ /*
+ * Ensure that the device passed in is a raw device.
+ */
+ if (stat(cp, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFCHR)
+ return (cp);
- if (dp == NULL)
- return (NULL);
- *dp = '\0';
- (void)strlcpy(rawbuf, cp, MAXPATHLEN - 1);
- *dp = '/';
- (void)strlcat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
- (void)strlcat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
- return (rawbuf);
+ /*
+ * Since there's only one device type now, we can't construct any
+ * better name, so we have to return NULL.
+ */
+ return (NULL);
}
/*
OpenPOWER on IntegriCloud