Magellan Linux

Diff of /trunk/mkinitrd-magellan/klibc/usr/dash/exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1121 by niro, Fri Apr 24 18:32:46 2009 UTC revision 1122 by niro, Wed Aug 18 21:11:40 2010 UTC
# Line 149  shellexec(char **argv, const char *path, Line 149  shellexec(char **argv, const char *path,
149  STATIC void  STATIC void
150  tryexec(char *cmd, char **argv, char **envp)  tryexec(char *cmd, char **argv, char **envp)
151  {  {
152   int repeated = 0;   char *const path_bshell = _PATH_BSHELL;
 #if !defined(BSD) && !defined(linux)  
  char *p;  
 #endif  
153    
154  repeat:  repeat:
155  #ifdef SYSV  #ifdef SYSV
# Line 162  repeat: Line 159  repeat:
159  #else  #else
160   execve(cmd, argv, envp);   execve(cmd, argv, envp);
161  #endif  #endif
162   if (repeated++) {   if (cmd != path_bshell && errno == ENOEXEC) {
163   ckfree(argv);   *argv-- = cmd;
164   } else if (errno == ENOEXEC) {   *argv = cmd = path_bshell;
  char **ap;  
  char **new;  
   
  for (ap = argv; *ap; ap++)  
  ;  
  ap = new = ckmalloc((ap - argv + 2) * sizeof(char *));  
  *ap++ = cmd = _PATH_BSHELL;  
  while ((*ap++ = *argv++))  
  ;  
  argv = new;  
165   goto repeat;   goto repeat;
166   }   }
167  }  }

Legend:
Removed from v.1121  
changed lines
  Added in v.1122