mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-25 15:49:08 -05:00
BUG: the return value of scanf should not be ignored
This commit is contained in:
@@ -70,7 +70,11 @@ int main(int ac, char *av[])
|
||||
printf("To run a test, enter the test number: ");
|
||||
fflush(stdout);
|
||||
testNum = 0;
|
||||
scanf("%d", &testNum);
|
||||
if( scanf("%d", &testNum) != 1 )
|
||||
{
|
||||
printf("Couldn't parse that input as a number\n");
|
||||
return -1;
|
||||
}
|
||||
if (testNum >= NumTests)
|
||||
{
|
||||
printf("%3d is an invalid test number.\n", testNum);
|
||||
|
||||
Reference in New Issue
Block a user