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