Changeset 493

Show
Ignore:
Timestamp:
07/31/2005 12:55:07 PM (3 years ago)
Author:
jan
Message:

use exec to replace the shell

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.3.x/src/spawn-fcgi.c

    r400 r493  
    1111 
    1212#include "config.h" 
     13 
    1314 
    1415#ifdef HAVE_PWD_H 
     
    121122                case 0: { 
    122123                        char cgi_childs[64]; 
     124                        char *b; 
    123125                         
    124126                        int i = 0; 
     
    142144                        putenv(cgi_childs); 
    143145                         
     146                        /* fork and replace shell */ 
     147                        b = malloc(strlen("exec ") + strlen(appPath) + 1); 
     148                        strcpy(b, "exec "); 
     149                        strcat(b, appPath); 
     150                         
    144151                        /* exec the cgi */ 
    145                         execl("/bin/sh", "sh", "-c", appPath, NULL); 
     152                        execl("/bin/sh", "sh", "-c", b, NULL); 
    146153                         
    147154                        exit(errno); 
     
    211218void show_version () { 
    212219        char *b = "spawn-fcgi" "-" PACKAGE_VERSION \ 
    213 " - spawns fastcgi processes\n" \ 
    214 "Build-Date: " __DATE__ " " __TIME__ "\n"; 
     220" - spawns fastcgi processes\n"  
    215221; 
    216222        write(1, b, strlen(b));