changeset 25625:501847ab4460

Use getppid instead of getpid and move a snprintf to where it is actually needed.
author reimar
date Tue, 08 Jan 2008 22:18:48 +0000
parents 7703675af42d
children f689811209b1
files mplayer.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Tue Jan 08 22:18:35 2008 +0000
+++ b/mplayer.c	Tue Jan 08 22:18:48 2008 +0000
@@ -780,12 +780,12 @@
 #ifdef CRASH_DEBUG
       if (crash_debug) {
         int gdb_pid;
-        char spid[20];
-        snprintf(spid, sizeof(spid), "%i", getpid());
         mp_msg(MSGT_CPLAYER, MSGL_INFO, "Forking...\n");
         gdb_pid = fork();
         mp_msg(MSGT_CPLAYER, MSGL_INFO, "Forked...\n");
         if (gdb_pid == 0) { // We are the child
+          char spid[20];
+          snprintf(spid, sizeof(spid), "%i", getppid());
           getch2_disable(); // allow terminal to work properly with gdb
           if (execlp("gdb", "gdb", prog_path, spid, "-ex", "bt", NULL) == -1)
             mp_msg(MSGT_CPLAYER, MSGL_ERR, "Couldn't start gdb\n");