diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index 7951422f53f..ba933c82b04 100644 --- a/release/sysinstall/devices.c +++ b/release/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.36.2.11 1995/11/15 06:57:02 jkh Exp $ + * $Id: devices.c,v 1.37 1995/12/07 10:33:38 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -166,6 +167,8 @@ deviceTry(char *name, char *try) fd = open(try, O_RDWR); if (fd > 0) return fd; + else if (errno == EACCES) + return 0; snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name); fd = open(try, O_RDWR); return fd; @@ -251,7 +254,7 @@ deviceGetAll(void) case DEVICE_TYPE_CDROM: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); (void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL, mediaShutdownCDROM, NULL); @@ -262,7 +265,7 @@ deviceGetAll(void) case DEVICE_TYPE_TAPE: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, NULL, mediaShutdownTape, NULL); msgDebug("Found a device of type TAPE named: %s\n", device_names[i].name); @@ -272,7 +275,7 @@ deviceGetAll(void) case DEVICE_TYPE_FLOPPY: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy, NULL, mediaShutdownFloppy, NULL); @@ -283,7 +286,7 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); /* The only network devices that have fds associated are serial ones */ deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); diff --git a/release/sysinstall/disks.c b/release/sysinstall/disks.c index fb29202265b..0f9bf5b0552 100644 --- a/release/sysinstall/disks.c +++ b/release/sysinstall/disks.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: disks.c,v 1.32 1995/09/18 16:52:23 peter Exp $ + * $Id: disks.c,v 1.33 1995/12/07 10:33:39 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -520,10 +520,6 @@ partitionHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; diskPartition(devs[0], (Disk *)devs[0]->private); str = cp; diff --git a/release/sysinstall/label.c b/release/sysinstall/label.c index 21ef26711ae..a7030a2739c 100644 --- a/release/sysinstall/label.c +++ b/release/sysinstall/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.33 1995/09/18 16:52:28 peter Exp $ + * $Id: label.c,v 1.34 1995/12/07 10:33:54 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -108,10 +108,6 @@ labelHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; str = cp; } @@ -137,7 +133,8 @@ diskLabelEditor(char *str) return RET_FAIL; } else if (cnt == 1 || variable_get(DISK_SELECTED)) { - devs[0]->enabled = TRUE; + if (cnt == 1) + devs[0]->enabled = TRUE; if (str && !strcmp(str, "script")) i = scriptLabel(str); else diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index 7951422f53f..ba933c82b04 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.36.2.11 1995/11/15 06:57:02 jkh Exp $ + * $Id: devices.c,v 1.37 1995/12/07 10:33:38 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -166,6 +167,8 @@ deviceTry(char *name, char *try) fd = open(try, O_RDWR); if (fd > 0) return fd; + else if (errno == EACCES) + return 0; snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name); fd = open(try, O_RDWR); return fd; @@ -251,7 +254,7 @@ deviceGetAll(void) case DEVICE_TYPE_CDROM: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); (void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL, mediaShutdownCDROM, NULL); @@ -262,7 +265,7 @@ deviceGetAll(void) case DEVICE_TYPE_TAPE: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, NULL, mediaShutdownTape, NULL); msgDebug("Found a device of type TAPE named: %s\n", device_names[i].name); @@ -272,7 +275,7 @@ deviceGetAll(void) case DEVICE_TYPE_FLOPPY: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy, NULL, mediaShutdownFloppy, NULL); @@ -283,7 +286,7 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); /* The only network devices that have fds associated are serial ones */ deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index fb29202265b..0f9bf5b0552 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/disks.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: disks.c,v 1.32 1995/09/18 16:52:23 peter Exp $ + * $Id: disks.c,v 1.33 1995/12/07 10:33:39 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -520,10 +520,6 @@ partitionHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; diskPartition(devs[0], (Disk *)devs[0]->private); str = cp; diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 21ef26711ae..a7030a2739c 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.33 1995/09/18 16:52:28 peter Exp $ + * $Id: label.c,v 1.34 1995/12/07 10:33:54 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -108,10 +108,6 @@ labelHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; str = cp; } @@ -137,7 +133,8 @@ diskLabelEditor(char *str) return RET_FAIL; } else if (cnt == 1 || variable_get(DISK_SELECTED)) { - devs[0]->enabled = TRUE; + if (cnt == 1) + devs[0]->enabled = TRUE; if (str && !strcmp(str, "script")) i = scriptLabel(str); else diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 7951422f53f..ba933c82b04 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: devices.c,v 1.36.2.11 1995/11/15 06:57:02 jkh Exp $ + * $Id: devices.c,v 1.37 1995/12/07 10:33:38 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -166,6 +167,8 @@ deviceTry(char *name, char *try) fd = open(try, O_RDWR); if (fd > 0) return fd; + else if (errno == EACCES) + return 0; snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name); fd = open(try, O_RDWR); return fd; @@ -251,7 +254,7 @@ deviceGetAll(void) case DEVICE_TYPE_CDROM: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); (void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM, NULL, mediaShutdownCDROM, NULL); @@ -262,7 +265,7 @@ deviceGetAll(void) case DEVICE_TYPE_TAPE: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, NULL, mediaShutdownTape, NULL); msgDebug("Found a device of type TAPE named: %s\n", device_names[i].name); @@ -272,7 +275,7 @@ deviceGetAll(void) case DEVICE_TYPE_FLOPPY: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy, NULL, mediaShutdownFloppy, NULL); @@ -283,7 +286,7 @@ deviceGetAll(void) case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i].name, try); if (fd >= 0) { - close(fd); + if (fd) close(fd); /* The only network devices that have fds associated are serial ones */ deviceRegister(device_names[i].name, device_names[i].description, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork, NULL, NULL, mediaShutdownNetwork, NULL); diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index fb29202265b..0f9bf5b0552 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: disks.c,v 1.32 1995/09/18 16:52:23 peter Exp $ + * $Id: disks.c,v 1.33 1995/12/07 10:33:39 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -520,10 +520,6 @@ partitionHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; diskPartition(devs[0], (Disk *)devs[0]->private); str = cp; diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 21ef26711ae..a7030a2739c 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: label.c,v 1.33 1995/09/18 16:52:28 peter Exp $ + * $Id: label.c,v 1.34 1995/12/07 10:33:54 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -108,10 +108,6 @@ labelHook(char *str) msgConfirm("Unable to find disk %s!", str); return 0; } - else if (devs[1]) { - dialog_clear(); - msgConfirm("Bizarre multiple match for %s!", str); - } devs[0]->enabled = TRUE; str = cp; } @@ -137,7 +133,8 @@ diskLabelEditor(char *str) return RET_FAIL; } else if (cnt == 1 || variable_get(DISK_SELECTED)) { - devs[0]->enabled = TRUE; + if (cnt == 1) + devs[0]->enabled = TRUE; if (str && !strcmp(str, "script")) i = scriptLabel(str); else