mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
'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
This commit is contained in:
parent
cfdb76e5b0
commit
f8aa7a835c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145238
@ -659,29 +659,19 @@ sig(int signo)
|
|||||||
char *
|
char *
|
||||||
rawname(char *cp)
|
rawname(char *cp)
|
||||||
{
|
{
|
||||||
static char rawbuf[MAXPATHLEN];
|
|
||||||
char *dp;
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (stat(cp, &sb) == 0) {
|
/*
|
||||||
/*
|
* Ensure that the device passed in is a raw device.
|
||||||
* If the name already refers to a raw device, return
|
*/
|
||||||
* it immediately without tampering.
|
if (stat(cp, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFCHR)
|
||||||
*/
|
return (cp);
|
||||||
if ((sb.st_mode & S_IFMT) == S_IFCHR)
|
|
||||||
return (cp);
|
|
||||||
}
|
|
||||||
|
|
||||||
dp = strrchr(cp, '/');
|
/*
|
||||||
|
* Since there's only one device type now, we can't construct any
|
||||||
if (dp == NULL)
|
* better name, so we have to return NULL.
|
||||||
return (NULL);
|
*/
|
||||||
*dp = '\0';
|
return (NULL);
|
||||||
(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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user