Blob Blame History Raw
--- xlock/xlock.c	2011-05-24 03:53:46.000000000 +0200
+++ xlock/xlock.c	2012-11-19 12:47:42.592261929 +0100
@@ -1052,6 +1052,7 @@ syslogStop(char *displayName)
 #endif
 
 char error_buf[ERROR_BUF];
+static int error_exitcode = 1;
 
 void
 error(const char *buf)
@@ -1068,7 +1069,14 @@ error(const char *buf)
 #else
 	(void) fprintf(stderr, "%s", buf);
 #endif
-	exit(1);
+	if (error_exitcode < 0) {
+		int sig = -error_exitcode;
+		signal(sig, SIG_DFL);
+		raise(sig);
+		/* We are still alive?? */
+		error_exitcode = sig + 128;
+	}
+	exit(error_exitcode);
 }
 
 /* Server access control support. */
@@ -2946,6 +2954,7 @@ sigcatch(int signum)
 		ProgramName: DEFAULT_NAME, signum,
 		(strlen(ProgramName) + strlen(name) <
 		ERROR_BUF - 2 * ERROR_LINE) ?  name: "?", (long) getuid());
+	error_exitcode = -signum;
 	error(error_buf);
 #endif /* !WIN32 */
 }