~ubuntu-branches/ubuntu/hardy/libgksu/hardy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/16_fix_waitpid.patch

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2007-06-22 12:19:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070622121942-gco426p6wgpt43qw
Tags: 2.0.5-1ubuntu2
* debian/patches/16_fix_waitpid.patch:
  - do not return from gksu until the process started by it
    has finished (restore old behaviour)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Nur libgksu-2.0.5/libgksu/libgksu.c libgksu-2.0.5.new/libgksu/libgksu.c
 
2
--- libgksu-2.0.5/libgksu/libgksu.c     2007-06-22 12:48:13.000000000 +0200
 
3
+++ libgksu-2.0.5.new/libgksu/libgksu.c 2007-06-22 12:48:33.000000000 +0200
 
4
@@ -2312,7 +2312,8 @@
 
5
       cmdline = g_strdup("bin/su");
 
6
       /* wait for the child process to end or become something other
 
7
         than su */
 
8
-      while ((!waitpid (pid, &status, WNOHANG)) &&
 
9
+      pid_t pid_exited;
 
10
+      while ((!(pid_exited = waitpid (pid, &status, WNOHANG))) &&
 
11
             (g_str_has_suffix(cmdline, "bin/su")))
 
12
        {
 
13
          if (cmdline)
 
14
@@ -2331,7 +2332,7 @@
 
15
          bzero(buf, 256);
 
16
        }
 
17
 
 
18
-      if (!WIFEXITED(status))
 
19
+      if (pid_exited != pid)
 
20
        waitpid(pid, &status, 0);
 
21
 
 
22
       if (WEXITSTATUS(status))
 
23
@@ -2807,7 +2808,8 @@
 
24
       cmdline = g_strdup("sudo");
 
25
       /* wait for the child process to end or become something other
 
26
         then sudo */
 
27
-      while ((!waitpid (pid, &status, WNOHANG)) &&
 
28
+      pid_t pid_exited;
 
29
+      while ((!(pid_exited = waitpid (pid, &status, WNOHANG))) &&
 
30
             (g_str_has_suffix(cmdline, "sudo")))
 
31
        {
 
32
          if (cmdline)
 
33
@@ -2825,7 +2827,8 @@
 
34
          bzero(buffer, 256);
 
35
        }
 
36
 
 
37
-      if (!WIFEXITED(status))
 
38
+      // if the process is still active waitpid() on it
 
39
+      if (pid_exited != pid)
 
40
        waitpid(pid, &status, 0);
 
41
       sudo_reset_xauth (context, xauth, xauth_env);
 
42