Rev 3718 | Rev 8082 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3718 | Rev 3835 | ||
---|---|---|---|
Line 126... | Line 126... | ||
126 | 126 | ||
127 | fflush(NULL); /* flush all output streams before forking |
127 | fflush(NULL); /* flush all output streams before forking |
128 | * otherwise they will be doubled */ |
128 | * otherwise they will be doubled */ |
129 | pid=fork(); if(pid==-1) return -1; |
129 | pid=fork(); if(pid==-1) return -1; |
130 | if(!pid) { /* child */ |
130 | if(!pid) { /* child */ |
131 | if(inf!=NULL |
131 | if(inf!=NULL && freopen(inf,"r",stdin) == NULL) |
- | 132 | error("freopen failure"); |
|
132 | if(outf!=NULL |
133 | if(outf!=NULL && freopen(outf,"w",stdout)) |
- | 134 | error("freopen failure"); |
|
133 | if(errf!=NULL |
135 | if(errf!=NULL && freopen(errf,"w",stderr)) |
- | 136 | error("freopen failure"); |
|
134 | if(wrapexec) { |
137 | if(wrapexec) { |
135 | setreuid(getuid(),getuid());setregid(getgid(),getgid()); |
138 | setreuid(getuid(),getuid());setregid(getgid(),getgid()); |
136 | } |
139 | } |
137 | if(strchr(cmdf,'/')) execv(cmdf,arg); |
140 | if(strchr(cmdf,'/')) execv(cmdf,arg); |
138 | else execvp(cmdf,arg); |
141 | else execvp(cmdf,arg); |