cvs: php-src /ext/posix posix.c
| From: | Antony Dovgal | Date: | Fri, 28 Jan 2005 01:38:56 +0000 |
| Subject: | cvs: php-src /ext/posix posix.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-30188@lists.php.net to get a copy of this message | ||
tony2001 Thu Jan 27 20:38:56 2005 EDT
Modified files:
/php-src/ext/posix posix.c
Log:
change return type from NULL to FALSE when parameter parsing failed
(as was requested by Ilia)
http://cvs.php.net/diff.php/php-src/ext/posix/posix.c?r1=1.63&r2=1.64&ty=u
Index: php-src/ext/posix/posix.c
diff -u php-src/ext/posix/posix.c:1.63 php-src/ext/posix/posix.c:1.64
--- php-src/ext/posix/posix.c:1.63 Thu Jan 27 19:27:48 2005
+++ php-src/ext/posix/posix.c Thu Jan 27 20:38:56 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: posix.c,v 1.63 2005/01/28 00:27:48 tony2001 Exp $ */
+/* $Id: posix.c,v 1.64 2005/01/28 01:38:56 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -133,7 +133,7 @@
static PHP_MINFO_FUNCTION(posix)
{
php_info_print_table_start();
- php_info_print_table_row(2, "Revision", "$Revision: 1.63 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.64 $");
php_info_print_table_end();
}
/* }}} */
@@ -186,7 +186,7 @@
#define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \
long val; \
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE)
return; \
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE)
RETURN_FALSE; \
if (func_name(val) < 0) { \
POSIX_G(last_error) = errno; \
RETURN_FALSE; \
@@ -200,9 +200,10 @@
{
long pid, sig;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) ==
FAILURE)
- return;
-
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) ==
FAILURE) {
+ RETURN_FALSE;
+ }
+
if (kill(pid, sig) < 0) {
POSIX_G(last_error) = errno;
RETURN_FALSE;
@@ -360,8 +361,9 @@
{
long pid, pgid;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) ==
FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) ==
FAILURE) {
+ RETURN_FALSE;
+ }
if (setpgid(pid, pgid) < 0) {
POSIX_G(last_error) = errno;
@@ -379,7 +381,7 @@
{
long val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
- return;
+ RETURN_FALSE;
}
if ((val = getpgid(val)) < 0) {
@@ -398,7 +400,7 @@
{
long val;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) {
- return;
+ RETURN_FALSE;
}
if ((val = getsid(val)) < 0) {
@@ -519,8 +521,9 @@
char *p;
int fd;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) {
+ RETURN_FALSE;
+ }
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
@@ -549,9 +552,10 @@
zval *z_fd;
int fd;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE)
- return;
-
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) {
+ RETURN_FALSE;
+ }
+
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
if (!php_posix_stream_get_fd(z_fd, &fd TSRMLS_CC)) {
@@ -615,8 +619,9 @@
long mode;
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &path, &path_len,
&mode) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &path, &path_len,
&mode) == FAILURE) {
+ RETURN_FALSE;
+ }
if (PG(safe_mode) && (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
RETURN_FALSE;
@@ -673,8 +678,9 @@
int filename_len, ret;
char *filename, *path;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename,
&filename_len, &mode) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename,
&filename_len, &mode) == FAILURE) {
+ RETURN_FALSE;
+ }
path = expand_filepath(filename, NULL TSRMLS_CC);
@@ -712,8 +718,9 @@
struct group *g;
int name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) ==
FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) ==
FAILURE) {
+ RETURN_FALSE;
+ }
if (NULL == (g = getgrnam(name))) {
POSIX_G(last_error) = errno;
@@ -736,8 +743,9 @@
long gid;
struct group *g;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE) {
+ RETURN_FALSE;
+ }
if (NULL == (g = getgrgid(gid))) {
POSIX_G(last_error) = errno;
@@ -777,8 +785,9 @@
char *name;
int name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) ==
FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) ==
FAILURE) {
+ RETURN_FALSE;
+ }
if (NULL == (pw = getpwnam(name))) {
POSIX_G(last_error) = errno;
@@ -802,8 +811,9 @@
long uid;
struct passwd *pw;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) {
+ RETURN_FALSE;
+ }
if (NULL == (pw = getpwuid(uid))) {
POSIX_G(last_error) = errno;
@@ -951,8 +961,9 @@
{
long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) {
+ RETURN_FALSE;
+ }
RETURN_STRING(strerror(error), 1);
}