X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=src%2Fsighandler.c;h=a5115aa4a61cef0e2d8926bd099c50c536de32ba;hp=12ed0ef990dc7fc25bf15bb84f374d071d0c869a;hb=a15fff2370105af288c1ebfb925a9f51274efc22;hpb=50880db2c554ad73d5524ef21d376fab25129a5d diff --git a/src/sighandler.c b/src/sighandler.c index 12ed0ef9..a5115aa4 100644 --- a/src/sighandler.c +++ b/src/sighandler.c @@ -62,14 +62,13 @@ static int sighandler_backtrace(void) { 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++; - } while (stat(filename, &bt) == 0); + } while (path_exists(filename)); 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; - } else if (stat(filename, &bt) == -1) { + } else if (!path_exists(filename)) { DLOG("GDB executed successfully, but no backtrace was generated\n"); return -1; }