libbb: add skip_dev_pfx()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2010-04-06 18:50:05 +02:00
parent 87fb72032e
commit f8d8aa1cea
7 changed files with 17 additions and 21 deletions

View File

@@ -169,12 +169,12 @@ static char *base_device(const char *device)
const char *disk;
int len;
#endif
cp = str = xstrdup(device);
str = xstrdup(device);
/* Skip over /dev/; if it's not present, give up. */
if (strncmp(cp, "/dev/", 5) != 0)
/* Skip over "/dev/"; if it's not present, give up */
cp = skip_dev_pfx(str);
if (cp == str)
goto errout;
cp += 5;
/*
* For md devices, we treat them all as if they were all