Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.8
-
None
-
Patch Available
Description
TNonblockingServer calls exit(-1) when it encounters a std::bad_alloc exception. The -1 argument to exit() is problematic. Programs typically use non-zero exit codes since negative values are reserved for signals. On somewhat modern Linux (CentOS 6.0), exit(-1) causes the process to yield return code 255. which BASH claims is out of range:
http://tldp.org/LDP/abs/html/exitcodes.html
I don't see any advantage to exit(-1) in this case. If the intent is to exit with an error indication, 1 (or the EXIT_FAILURE macro) should do fine. If the intent is to signal program termination, possibly with a stack trace, abrt() would be better.
Attached is a patch for the simplest change from '-1' to '1'.
Thanks.