sasprintf() already handles errors, we don’t need to do that twice

This commit is contained in:
Michael Stapelberg 2012-09-11 13:02:59 +02:00
parent 9d8a4ebc61
commit e713283605

View File

@ -52,9 +52,7 @@ static int backtrace(void) {
pid_t pid_parent = getpid(); pid_t pid_parent = getpid();
char *filename = NULL; char *filename = NULL;
if (sasprintf(&filename, "%s/i3-backtrace.%d.txt", tmpdir, pid_parent) == -1 sasprintf(&filename, "%s/i3-backtrace.%d.txt", tmpdir, pid_parent);
|| filename == NULL)
filename = "i3-backtrace.txt";
pid_t pid_gdb = fork(); pid_t pid_gdb = fork();
if (pid_gdb < 0) { if (pid_gdb < 0) {
@ -81,13 +79,9 @@ static int backtrace(void) {
dup2(stdin_pipe[0], STDIN_FILENO); dup2(stdin_pipe[0], STDIN_FILENO);
dup2(stdout_pipe[1], STDOUT_FILENO); dup2(stdout_pipe[1], STDOUT_FILENO);
char *pid_s = NULL; char *pid_s, *gdb_log_cmd;
sasprintf(&pid_s, "%d", pid_parent); sasprintf(&pid_s, "%d", pid_parent);
sasprintf(&gdb_log_cmd, "set logging file %s", filename);
char *gdb_log_cmd = NULL;
if (sasprintf(&gdb_log_cmd, "set logging file %s", filename) == -1
|| gdb_log_cmd == NULL)
gdb_log_cmd = "set logging file i3-backtrace.txt";
char *args[] = { char *args[] = {
"gdb", "gdb",