Browse Source

Off by one limit in device selection.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
d5d56920dd
  1. 6
      main.c

6
main.c

@ -1859,7 +1859,7 @@ retry:
if (!strncasecmp(&input, "e", 1)) { if (!strncasecmp(&input, "e", 1)) {
selected = curses_int("Select GPU to enable"); selected = curses_int("Select GPU to enable");
if (selected < 0 || selected > nDevs) { if (selected < 0 || selected >= nDevs) {
wlogprint("Invalid selection\n"); wlogprint("Invalid selection\n");
goto retry; goto retry;
} }
@ -1880,7 +1880,7 @@ retry:
} }
} if (!strncasecmp(&input, "d", 1)) { } if (!strncasecmp(&input, "d", 1)) {
selected = curses_int("Select GPU to disable"); selected = curses_int("Select GPU to disable");
if (selected < 0 || selected > nDevs) { if (selected < 0 || selected >= nDevs) {
wlogprint("Invalid selection\n"); wlogprint("Invalid selection\n");
goto retry; goto retry;
} }
@ -1891,7 +1891,7 @@ retry:
gpu_devices[selected] = false; gpu_devices[selected] = false;
} else if (!strncasecmp(&input, "r", 1)) { } else if (!strncasecmp(&input, "r", 1)) {
selected = curses_int("Select GPU to attempt to restart"); selected = curses_int("Select GPU to attempt to restart");
if (selected < 0 || selected > nDevs) { if (selected < 0 || selected >= nDevs) {
wlogprint("Invalid selection\n"); wlogprint("Invalid selection\n");
goto retry; goto retry;
} }

Loading…
Cancel
Save