diff options
author | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-12-03 04:41:30 +0000 |
---|---|---|
committer | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-12-03 04:41:30 +0000 |
commit | 20d0ca7a93ffe72dd8cd23223fc08c4bac934f43 (patch) | |
tree | 9e1a53e30068033309f5b701b3aa4be9da7b0ada /src/main/CommandLine.c | |
parent | a8569cd218d3d9aa7c690ad71a6ee9467fa0e1d4 (diff) |
Cactus allows for negative error level
Currently, Cactus allows to set a negative error level through the command line option. This leads to CCTK_WARN(0,"") not necessarily aborting. While this is not wrong by itself, a lot of code assumes an abort at that point.
This patch changes CCTKi_SetErrorLevel() to only accept non-negative error levels and to change the command-parsing code to give an error message for that case as well.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4923 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/CommandLine.c')
-rw-r--r-- | src/main/CommandLine.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/CommandLine.c b/src/main/CommandLine.c index 6b4b1f2e..82a118e5 100644 --- a/src/main/CommandLine.c +++ b/src/main/CommandLine.c @@ -379,7 +379,17 @@ void CCTKi_CommandLineErrorLevel (const char *argument) errorlevel = strtol (argument, &endptr, 10); if (endptr && *endptr == 0) { - CCTKi_SetErrorLevel (errorlevel); + if (errorlevel < 0) + { + CCTK_VWarn (0, __LINE__, __FILE__, "Cactus", + "Error level cannot be negative, but %d was requested.", + (int)errorlevel); + CCTK_Exit (NULL, 1); + } + else + { + CCTKi_SetErrorLevel (errorlevel); + } } else { |