cvs: php4 /ext/standard exec.c
| From: | Sean Bright | Date: | Sat, 28 Apr 2001 13:16:19 +0000 |
| Subject: | cvs: php4 /ext/standard exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5345@lists.php.net to get a copy of this message | ||
elixer Sat Apr 28 06:16:19 2001 EDT
Modified files:
/php4/ext/standard exec.c
Log:
- Fix for bugs #9042, #8212, and #8962. Patch from <tunacat@yahoo.com>
- Fixed proto for exec()
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.52 php4/ext/standard/exec.c:1.53
--- php4/ext/standard/exec.c:1.52 Sun Feb 25 22:07:17 2001
+++ php4/ext/standard/exec.c Sat Apr 28 06:16:18 2001
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.52 2001/02/26 06:07:17 andi Exp $ */
+/* $Id: exec.c,v 1.53 2001/04/28 13:16:18 elixer Exp $ */
#include <stdio.h>
#include "php.h"
@@ -194,8 +194,10 @@
/* strip trailing spaces */
l = strlen(buf);
t = l;
- while (l && isspace((int)buf[--l]));
- if (l < t) buf[l + 1] = '\0';
+ while (l && isspace((int)buf[l - 1])) {
+ l--;
+ }
+ if (l < t) buf[l] = '\0';
/* Return last line from the shell command */
if (PG(magic_quotes_runtime)) {
@@ -204,7 +206,7 @@
tmp = php_addslashes(buf, 0, &len, 0);
RETVAL_STRINGL(tmp,len,0);
} else {
- RETVAL_STRINGL(buf,l?l+1:0,1);
+ RETVAL_STRINGL(buf,l,1);
}
} else {
int b, i;
@@ -233,7 +235,7 @@
return FG(pclose_ret);
}
-/* {{{ proto int exec(string command [, array output [, int return_value]])
+/* {{{ proto string exec(string command [, array output [, int return_value]])
Execute an external program */
PHP_FUNCTION(exec)
{