Make open_disk() fail nicely upon encountering an ENOENT so to not
prematurely terminate the search for a usable disk. ENOENT is quite normal in particulare now with the advent of devfs. While being here, also remove /dev/wd0 and /dev/od0 from the list of disks to search since we don't have them anymore. MFC after: 1 week
This commit is contained in:
parent
6209021ebd
commit
8de9ed220e
@ -69,7 +69,7 @@ int secsize = 0; /* the sensed sector size */
|
||||
const char *disk;
|
||||
const char *disks[] =
|
||||
{
|
||||
"/dev/ad0", "/dev/wd0", "/dev/da0", "/dev/od0", 0
|
||||
"/dev/ad0", "/dev/da0", 0
|
||||
};
|
||||
|
||||
struct disklabel disklabel; /* disk parameters */
|
||||
@ -692,9 +692,11 @@ int fd;
|
||||
static int
|
||||
open_disk(int u_flag)
|
||||
{
|
||||
struct stat st;
|
||||
struct stat st;
|
||||
|
||||
if (stat(disk, &st) == -1) {
|
||||
if (errno == ENOENT)
|
||||
return -2;
|
||||
warnx("can't get file status of %s", disk);
|
||||
return -1;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int secsize = 0; /* the sensed sector size */
|
||||
const char *disk;
|
||||
const char *disks[] =
|
||||
{
|
||||
"/dev/ad0", "/dev/wd0", "/dev/da0", "/dev/od0", 0
|
||||
"/dev/ad0", "/dev/da0", 0
|
||||
};
|
||||
|
||||
struct disklabel disklabel; /* disk parameters */
|
||||
@ -692,9 +692,11 @@ int fd;
|
||||
static int
|
||||
open_disk(int u_flag)
|
||||
{
|
||||
struct stat st;
|
||||
struct stat st;
|
||||
|
||||
if (stat(disk, &st) == -1) {
|
||||
if (errno == ENOENT)
|
||||
return -2;
|
||||
warnx("can't get file status of %s", disk);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user