diff options
| author | Warner Losh <imp@FreeBSD.org> | 2005-04-18 15:08:29 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2005-04-18 15:08:29 +0000 |
| commit | f8aa7a835c5d9ebdbe9a30a2e233e49ef7f990a6 (patch) | |
| tree | 6db51565da80ad469e87f46df76407e9cbc779a5 /sbin/dump | |
| parent | cfdb76e5b0dcf80874f54b24506ea204eaac41df (diff) | |
Notes
Diffstat (limited to 'sbin/dump')
| -rw-r--r-- | sbin/dump/main.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c index e4118025e52b..6af099522d0f 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); } /* |
