diff options
author | Zeev Suraski <zeev@php.net> | 2001-01-13 13:59:22 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-01-13 13:59:22 +0000 |
commit | 86624dfad95f3671ff5545ab5e164bb5a4d8aadb (patch) | |
tree | d55577043d72caab0d91ee05164e32ad12463603 /ext/standard/exec.c | |
parent | 93f4fa8d730ba082a73ec0040a71e48311b5cecf (diff) | |
download | php-git-86624dfad95f3671ff5545ab5e164bb5a4d8aadb.tar.gz |
- Fix exec() bug
- Merge fsock and file globals
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r-- | ext/standard/exec.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c index d1d4959ea1..27c06793cb 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -44,11 +44,12 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) FILE *fp; char *buf, *tmp=NULL; int buflen = 0; - int t, l, ret, output=1; + int t, l, output=1; int overflow_limit, lcmd, ldir; int rsrc_id; char *b, *c, *d=NULL; PLS_FETCH(); + FLS_FETCH(); buf = (char*) emalloc(EXEC_INPUT_BUF); if (!buf) { @@ -123,7 +124,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) * fd gets pclosed */ - rsrc_id = ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_fopen()); + rsrc_id = ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_popen()); if (type != 3) { l=0; @@ -195,16 +196,18 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) /* the zend_list_delete will pclose our popen'ed process */ zend_list_delete(rsrc_id); - + #if HAVE_SYS_WAIT_H - if (WIFEXITED(ret)) { - ret = WEXITSTATUS(ret); + if (WIFEXITED(FG(pclose_ret))) { + ret = WEXITSTATUS(FG(pclose_ret)); } #endif - if (d) efree(d); + if (d) { + efree(d); + } efree(buf); - return ret; + return FG(pclose_ret); } /* {{{ proto int exec(string command [, array output [, int return_value]]) |