harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r620581 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni: shared/process.c unix/procimpl.c windows/procimpl.c
Date Mon, 11 Feb 2008 19:12:45 GMT
Author: hindessm
Date: Mon Feb 11 11:12:39 2008
New Revision: 620581

URL: http://svn.apache.org/viewvc?rev=620581&view=rev
Log:
Fixing bug spotted while fixing HARMONY-5485.  When calling
Runtime.exec(String[] cmd, String[] envp, File dir), it should
fail if chdir(dir) fails.
Added a TODO with another improvement but I wanted to fix the main issue
first.

There are still a couple more bugs in this code that I hope to fix in
the next day or two.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/procimpl.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c?rev=620581&r1=620580&r2=620581&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/process.c Mon
Feb 11 11:12:39 2008
@@ -139,6 +139,9 @@
         case 1003 : 
             sprintf(errMsg, "Unable to start program : %s", "too many open files");
             break;
+        case 1004 : 
+            sprintf(errMsg, "Unable to start program : %s", "no such file or directory");
+            break;
         default:
             sprintf(errMsg, "Unable to start program : %s", "unknown");
             break;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c?rev=620581&r1=620580&r2=620581&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c Mon
Feb 11 11:12:39 2008
@@ -102,6 +102,7 @@
  *     1001  fork failure errno = ENOMEM
  *     1002  fork failure errno = EAGAIN
  *     1003  pipe failure errno = EMFILE
+ *     1004  chdir failure errno = ENOENT
  *     -1    error, unknown
  * 
  *   Note - there is one error code 'namespace' for execProgram
@@ -156,7 +157,11 @@
     write(forkedChildIsRunning[1], &dummy, 1);
 
     if (dir) {
-      chdir(dir);
+      if (chdir(dir) == -1) {
+        /* TODO: write errno so parent can return correct error */
+        write(execvFailure[1], &dummy, 1);
+        exit(-1);
+      }
     }
 
     /* ===try to perform the execv : on success, it does not return ===== */

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/procimpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/procimpl.c?rev=620581&r1=620580&r2=620581&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/procimpl.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/procimpl.c Mon
Feb 11 11:12:39 2008
@@ -53,6 +53,7 @@
  *     1001  fork failure errno = ENOMEM
  *     1002  fork failure errno = EAGAIN
  *     1003  pipe failure errno = EMFILE
+ *     1004  chdir failure errno = ENOENT
  *     -1    error, unknown
  * 
  *   TODO - fill in windows error codes 



Mime
View raw message