summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2001-07-05 10:04:43 +0000
committerjoerg <joerg@FreeBSD.org>2001-07-05 10:04:43 +0000
commitcc4212cf2cb9ad92fcf05381c4e72b0c947b229f (patch)
tree0462beaf45251170837b0a5496a886cea988cec1 /sbin
parente8a61c0bf51aa563721397dc6ce45ac4d33ae3f8 (diff)
downloadFreeBSD-src-cc4212cf2cb9ad92fcf05381c4e72b0c947b229f.zip
FreeBSD-src-cc4212cf2cb9ad92fcf05381c4e72b0c947b229f.tar.gz
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
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fdisk/fdisk.c6
-rw-r--r--sbin/i386/fdisk/fdisk.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 1bf925f..1cb2ec3 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -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;
}
diff --git a/sbin/i386/fdisk/fdisk.c b/sbin/i386/fdisk/fdisk.c
index 1bf925f..1cb2ec3 100644
--- a/sbin/i386/fdisk/fdisk.c
+++ b/sbin/i386/fdisk/fdisk.c
@@ -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;
}
OpenPOWER on IntegriCloud