summaryrefslogtreecommitdiffstats
path: root/Templates
diff options
context:
space:
mode:
authorAmitha Perera <perera@cs.rpi.edu>2008-11-25 14:52:21 (GMT)
committerAmitha Perera <perera@cs.rpi.edu>2008-11-25 14:52:21 (GMT)
commit47aa926523131ca59a64c6342b37c563d6a942f0 (patch)
treee8ab147f584266d4a94cad20bddd4a6cb3c92ac3 /Templates
parent26c7a187b41651a1e55fdc943bf6519c99a3a7ec (diff)
downloadCMake-47aa926523131ca59a64c6342b37c563d6a942f0.zip
CMake-47aa926523131ca59a64c6342b37c563d6a942f0.tar.gz
CMake-47aa926523131ca59a64c6342b37c563d6a942f0.tar.bz2
BUG: the return value of scanf should not be ignored
Diffstat (limited to 'Templates')
-rw-r--r--Templates/TestDriver.cxx.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index 41fccae..8c9f54e 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.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);