OSDN Git Service

Merge remote-tracking branch 'github/cm-10.2' into cm-11.0
authorKoushik Dutta <koushd@gmail.com>
Fri, 29 Nov 2013 17:13:46 +0000 (09:13 -0800)
committerKoushik Dutta <koushd@gmail.com>
Fri, 29 Nov 2013 17:13:46 +0000 (09:13 -0800)
Conflicts:
Superuser/jni/su/daemon.c

Change-Id: Ia849b63cf44d8da9e31b1fbe13b54b0b8289e75d

1  2 
Superuser/jni/su/daemon.c

@@@ -270,9 -273,13 +273,13 @@@ static int daemon_accept(int fd) 
          if(grantpt(ptm) || unlockpt(ptm) || ((devname = (char*) ptsname(ptm)) == 0)) {
              PLOGE("ptm setup");
              close(ptm);
+ unlink_n_exit:
+             unlink(infile);
+             unlink(errfile);
+             unlink(outfile);
              exit(-1);
          }
 -        LOGD("devname: %s", devname);
 +        LOGV("devname: %s", devname);
      }
  
      int outfd = open(outfile, O_WRONLY);
      // wait for the child to exit, and send the exit code
      // across the wire.
      int status;
 -    LOGD("waiting for child exit");
 +    LOGV("waiting for child exit");
      if (waitpid(child, &status, 0) > 0) {
-         code = WEXITSTATUS(status);
+         if (WIFEXITED(status)) {
+             code = WEXITSTATUS(status);
+         } else if (WIFSIGNALED(status)) {
+             code = 128 + WTERMSIG(status);
+         } else {
+             code = -1;
+         }
      }
      else {
          code = -1;