Skip to content

ext/posix: changing helpers return to zend_result. #13957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ext/posix/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,14 @@ PHP_FUNCTION(posix_ctermid)
/* }}} */

/* Checks if the provides resource is a stream and if it provides a file descriptor */
static int php_posix_stream_get_fd(zval *zfp, zend_long *fd) /* {{{ */
static zend_result php_posix_stream_get_fd(zval *zfp, zend_long *fd) /* {{{ */
{
php_stream *stream;

php_stream_from_zval_no_verify(stream, zfp);

if (stream == NULL) {
return 0;
return FAILURE;
}

/* get the fd.
Expand All @@ -437,9 +437,9 @@ static int php_posix_stream_get_fd(zval *zfp, zend_long *fd) /* {{{ */
} else {
php_error_docref(NULL, E_WARNING, "Could not use stream of type '%s'",
stream->ops->label);
return 0;
return FAILURE;
}
return 1;
return SUCCESS;
}
/* }}} */

Expand All @@ -459,7 +459,7 @@ PHP_FUNCTION(posix_ttyname)
ZEND_PARSE_PARAMETERS_END();

if (Z_TYPE_P(z_fd) == IS_RESOURCE) {
if (!php_posix_stream_get_fd(z_fd, &fd)) {
if (php_posix_stream_get_fd(z_fd, &fd) == FAILURE) {
RETURN_FALSE;
}
} else {
Expand Down Expand Up @@ -520,7 +520,7 @@ PHP_FUNCTION(posix_isatty)
ZEND_PARSE_PARAMETERS_END();

if (Z_TYPE_P(z_fd) == IS_RESOURCE) {
if (!php_posix_stream_get_fd(z_fd, &fd)) {
if (php_posix_stream_get_fd(z_fd, &fd) == FAILURE) {
RETURN_FALSE;
}
} else {
Expand Down Expand Up @@ -1044,7 +1044,7 @@ PHP_FUNCTION(posix_getpwuid)
#define UNLIMITED_STRING "unlimited"

/* {{{ posix_addlimit */
static int posix_addlimit(int limit, const char *name, zval *return_value) {
static zend_result posix_addlimit(int limit, const char *name, zval *return_value) {
int result;
struct rlimit rl;
char hard[80];
Expand Down Expand Up @@ -1316,7 +1316,7 @@ PHP_FUNCTION(posix_fpathconf)
ZEND_PARSE_PARAMETERS_END();

if (Z_TYPE_P(z_fd) == IS_RESOURCE) {
if (!php_posix_stream_get_fd(z_fd, &fd)) {
if (php_posix_stream_get_fd(z_fd, &fd) == FAILURE) {
RETURN_FALSE;
}
} else {
Expand Down