]> git.sur5r.net Git - i3/i3/blobdiff - src/sighandler.c
Merge branch 'next' into master
[i3/i3] / src / sighandler.c
index 12ed0ef990dc7fc25bf15bb84f374d071d0c869a..e49c30ba668efa3883ca048682481e16fb638e5b 100644 (file)
@@ -62,14 +62,13 @@ static int sighandler_backtrace(void) {
 
     char *filename = NULL;
     int suffix = 0;
 
     char *filename = NULL;
     int suffix = 0;
-    struct stat bt;
     /* Find a unique filename for the backtrace (since the PID of i3 stays the
      * same), so that we don’t overwrite earlier backtraces. */
     do {
         FREE(filename);
         sasprintf(&filename, "%s/i3-backtrace.%d.%d.txt", tmpdir, pid_parent, suffix);
         suffix++;
     /* Find a unique filename for the backtrace (since the PID of i3 stays the
      * same), so that we don’t overwrite earlier backtraces. */
     do {
         FREE(filename);
         sasprintf(&filename, "%s/i3-backtrace.%d.%d.txt", tmpdir, pid_parent, suffix);
         suffix++;
-    } while (stat(filename, &bt) == 0);
+    } while (path_exists(filename));
 
     pid_t pid_gdb = fork();
     if (pid_gdb < 0) {
 
     pid_t pid_gdb = fork();
     if (pid_gdb < 0) {
@@ -130,7 +129,7 @@ static int sighandler_backtrace(void) {
     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
         DLOG("GDB did not run properly\n");
         return -1;
     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
         DLOG("GDB did not run properly\n");
         return -1;
-    } else if (stat(filename, &bt) == -1) {
+    } else if (!path_exists(filename)) {
         DLOG("GDB executed successfully, but no backtrace was generated\n");
         return -1;
     }
         DLOG("GDB executed successfully, but no backtrace was generated\n");
         return -1;
     }
@@ -300,7 +299,7 @@ static void sighandler_handle_key_press(xcb_key_press_event_t *event) {
     }
 }
 
     }
 }
 
-void handle_signal(int sig, siginfo_t *info, void *data) {
+static void handle_signal(int sig, siginfo_t *info, void *data) {
     DLOG("i3 crashed. SIG: %d\n", sig);
 
     struct sigaction action;
     DLOG("i3 crashed. SIG: %d\n", sig);
 
     struct sigaction action;