After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788307 - Use standard exit codes.
Use standard exit codes.
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-28 19:35 UTC by Robert Ancell
Modified: 2017-10-03 20:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use standard exit codes. (17.80 KB, patch)
2017-09-28 19:35 UTC, Robert Ancell
none Details | Review
Use standard exit codes. (17.80 KB, patch)
2017-09-28 20:01 UTC, Robert Ancell
committed Details | Review

Description Robert Ancell 2017-09-28 19:35:54 UTC
Use standard exit codes.
Comment 1 Robert Ancell 2017-09-28 19:35:56 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.
Comment 2 Robert Ancell 2017-09-28 19:44:40 UTC
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.
Comment 3 Robert Ancell 2017-09-28 19:45:20 UTC
(awaiting review)
Comment 4 Ray Strode [halfline] 2017-09-28 19:46:26 UTC
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?)
Comment 5 Robert Ancell 2017-09-28 20:01:06 UTC
I believe it comes in via stdlib.h

Agree that should be EXIT_SUCCESS.
Comment 6 Robert Ancell 2017-09-28 20:01:23 UTC
Created attachment 360630 [details] [review]
Use standard exit codes.
Comment 7 Robert Ancell 2017-09-28 21:27:06 UTC
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).
Comment 8 Ray Strode [halfline] 2017-10-03 20:18:41 UTC
Attachment 360630 [details] pushed as 69420ae - Use standard exit codes.