From e8b7285da685866a373b1112115e6dc543991ca9 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Tue, 23 Oct 2012 08:55:40 +0000 Subject: Do not leave zombie process when running configure utilities. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@80664 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfinput/pad.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'plugins/dfinput') diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index 1074b9ae..d919ae39 100644 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -651,18 +651,33 @@ void PADregisterVibration(void (*callback)(uint32_t, uint32_t)) { #ifndef _MACOSX long PADconfigure(void) { - if (fork() == 0) { - execl("cfg/cfgDFInput", "cfgDFInput", NULL); + int pid = fork(); + + if (pid == 0) { + if (fork() == 0) { + execl("cfg/cfgDFInput", "cfgDFInput", NULL); + } exit(0); + } else if (pid > 0) { + waitpid(pid, NULL, 0); } + return PSE_PAD_ERR_SUCCESS; } void PADabout(void) { - if (fork() == 0) { - execl("cfg/cfgDFInput", "cfgDFInput", "-about", NULL); + int pid = fork(); + + if (pid == 0) { + if (fork() == 0) { + execl("cfg/cfgDFInput", "cfgDFInput", "-about", NULL); + } exit(0); + } else if (pid > 0) { + waitpid(pid, NULL, 0); } + + return PSE_PAD_ERR_SUCCESS; } #endif -- cgit v1.2.3