GNOME Bugzilla – Bug 788307
Use standard exit codes.
Last modified: 2017-10-03 20:18:44 UTC
Created attachment 360629 [details] [review] Use standard exit codes. Use EXIT_ defines for readibility. There were some exit codes > 1, but they don't seem to be checked by any of the parent process code. This does mean that the logs might have changed, but modern logging techniques have probably made this obsolete.
Of particular note are the following changes: - main() used to return -1 for non-root. Might have been significant at some point in time but since we're not using the same init systems from when xdm was popular seems unlikely. - There's a return 2 which was probably used to track different error codes. But since style is not consistently used in GDM doesn't seem significant. - There's a SERVER_ABORT return code but none of the other types are used, so it's probably not important. - There's a 127 return code which seems similar to the above.
(awaiting review)
Review of attachment 360629 [details] [review]: don't we need #include <sysexits.h> at the top of each file? or is it getting pulled in implicitly somehow? ::: daemon/main.c @@ +343,3 @@ if (print_version) { g_print ("GDM %s\n", VERSION); + return EXIT_FAILURE; should be EXIT_SUCCESS i think (but maybe that should be a separate commit?)
I believe it comes in via stdlib.h Agree that should be EXIT_SUCCESS.
Created attachment 360630 [details] [review] Use standard exit codes.
Ah, I wasn't actually aware of sysexits.h. EXIT_SUCCESS and EXIT_FAILURE are in stdlib.h and are defined in C89 (according to https://stackoverflow.com/questions/13667364/exit-failure-vs-exit1).
Attachment 360630 [details] pushed as 69420ae - Use standard exit codes.