GNOME Bugzilla – Bug 788302
daemon: Tidy up main() failure cases
Last modified: 2017-09-28 19:16:51 UTC
Remove goto that no longer does anything. Consistently use return instead of exit() from main. Print pre-log errors to stderr to ensure they're visible regardless of GLib settings.
Created attachment 360625 [details] [review] daemon: Tidy up main() failure cases Remove goto that no longer does anything. Consistently use return instead of exit() from main. Print pre-log errors to stderr to ensure they're visible regardless of GLib settings.
Review of attachment 360625 [details] [review]: sure. since you're here anyway, if you want to do a follow up fix or two... ::: daemon/main.c @@ +343,3 @@ if (print_version) { g_print ("GDM %s\n", VERSION); + return 1; it's weird that printing the version returns a value exit code. @@ +350,3 @@ /* make sure the pid file doesn't get wiped */ + g_printerr ("%s\n", _("Only the root user can run GDM")); + return -1; it's weird to return -1 when exit codes go from 0 to 255. maybe we should use sysexits.h ?
s/value exit code/failure value for an exit code/
I didn't change the error codes because I wasn't sure if they were significant due to the "XDM compliant error message" comment. I also thought they were weird, so happy to change them to standard ones.