mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-02 08:42:48 +00:00
Avoid rawname() stupidly prepending an `r' before the device name even
in cases where the supplied name was already pointing to a character special device. This fixes the breakage that occured when trying to dump a filesystem by name (e. g. /usr), with an fstab already mentioning the raw device name (like /dev/rda0g) where dump attempted to use /dev/rrda0g then. Also removed the now obsolete remark that fstab were carrying block special names.
This commit is contained in:
parent
45b318264e
commit
04285c0615
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58928
@ -46,6 +46,7 @@ static const char rcsid[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#ifdef sunos
|
#ifdef sunos
|
||||||
#include <sys/vnode.h>
|
#include <sys/vnode.h>
|
||||||
@ -548,7 +549,19 @@ rawname(cp)
|
|||||||
char *cp;
|
char *cp;
|
||||||
{
|
{
|
||||||
static char rawbuf[MAXPATHLEN];
|
static char rawbuf[MAXPATHLEN];
|
||||||
char *dp = strrchr(cp, '/');
|
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, '/');
|
||||||
|
|
||||||
if (dp == NULL)
|
if (dp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -437,11 +437,6 @@ getfstab()
|
|||||||
* Search in the fstab for a file name.
|
* Search in the fstab for a file name.
|
||||||
* This file name can be either the special or the path file name.
|
* This file name can be either the special or the path file name.
|
||||||
*
|
*
|
||||||
* The entries in the fstab are the BLOCK special names, not the
|
|
||||||
* character special names.
|
|
||||||
* The caller of fstabsearch assures that the character device
|
|
||||||
* is dumped (that is much faster)
|
|
||||||
*
|
|
||||||
* The file name can omit the leading '/'.
|
* The file name can omit the leading '/'.
|
||||||
*/
|
*/
|
||||||
struct fstab *
|
struct fstab *
|
||||||
|
Loading…
Reference in New Issue
Block a user