diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c index 5ce75f96bea4..3764642c76ad 100644 --- a/usr.sbin/bhyveload/bhyveload.c +++ b/usr.sbin/bhyveload/bhyveload.c @@ -664,21 +664,19 @@ altcons_open(char *path) static int disk_open(char *path) { - int err, fd; + int fd; if (ndisks >= NDISKS) return (ERANGE); - err = 0; fd = open(path, O_RDONLY); + if (fd < 0) + return (errno); - if (fd > 0) { - disk_fd[ndisks] = fd; - ndisks++; - } else - err = errno; + disk_fd[ndisks] = fd; + ndisks++; - return (err); + return (0); } static void