@@ -588,7 +588,7 @@ static void init_process_info(PROCESS_INFORMATION *pi)
588
588
memset (& pi , 0 , sizeof (pi ));
589
589
}
590
590
591
- static int convert_command_to_use_shell (wchar_t * * cmdw , size_t cmdw_len )
591
+ static zend_result convert_command_to_use_shell (wchar_t * * cmdw , size_t cmdw_len )
592
592
{
593
593
size_t len = sizeof (COMSPEC_NT ) + sizeof (" /s /c " ) + cmdw_len + 3 ;
594
594
wchar_t * cmdw_shell = (wchar_t * )malloc (len * sizeof (wchar_t ));
@@ -659,7 +659,7 @@ static zend_string* get_string_parameter(zval *array, int index, char *param_nam
659
659
return zval_try_get_string (array_item );
660
660
}
661
661
662
- static int set_proc_descriptor_to_blackhole (descriptorspec_item * desc )
662
+ static zend_result set_proc_descriptor_to_blackhole (descriptorspec_item * desc )
663
663
{
664
664
#ifdef PHP_WIN32
665
665
desc -> childend = CreateFileA ("nul" , GENERIC_READ | GENERIC_WRITE ,
@@ -678,7 +678,7 @@ static int set_proc_descriptor_to_blackhole(descriptorspec_item *desc)
678
678
return SUCCESS ;
679
679
}
680
680
681
- static int set_proc_descriptor_to_pty (descriptorspec_item * desc , int * master_fd , int * slave_fd )
681
+ static zend_result set_proc_descriptor_to_pty (descriptorspec_item * desc , int * master_fd , int * slave_fd )
682
682
{
683
683
#if HAVE_OPENPTY
684
684
/* All FDs set to PTY in the child process will go to the slave end of the same PTY.
@@ -717,7 +717,7 @@ static php_file_descriptor_t make_descriptor_cloexec(php_file_descriptor_t fd)
717
717
#endif
718
718
}
719
719
720
- static int set_proc_descriptor_to_pipe (descriptorspec_item * desc , zend_string * zmode )
720
+ static zend_result set_proc_descriptor_to_pipe (descriptorspec_item * desc , zend_string * zmode )
721
721
{
722
722
php_file_descriptor_t newpipe [2 ];
723
723
@@ -754,7 +754,7 @@ static int set_proc_descriptor_to_pipe(descriptorspec_item *desc, zend_string *z
754
754
#define create_socketpair (socks ) socketpair(AF_UNIX, SOCK_STREAM, 0, (socks))
755
755
#endif
756
756
757
- static int set_proc_descriptor_to_socket (descriptorspec_item * desc )
757
+ static zend_result set_proc_descriptor_to_socket (descriptorspec_item * desc )
758
758
{
759
759
php_socket_t sock [2 ];
760
760
@@ -774,7 +774,7 @@ static int set_proc_descriptor_to_socket(descriptorspec_item *desc)
774
774
return SUCCESS ;
775
775
}
776
776
777
- static int set_proc_descriptor_to_file (descriptorspec_item * desc , zend_string * file_path ,
777
+ static zend_result set_proc_descriptor_to_file (descriptorspec_item * desc , zend_string * file_path ,
778
778
zend_string * file_mode )
779
779
{
780
780
php_socket_t fd ;
@@ -807,7 +807,7 @@ static int set_proc_descriptor_to_file(descriptorspec_item *desc, zend_string *f
807
807
return SUCCESS ;
808
808
}
809
809
810
- static int dup_proc_descriptor (php_file_descriptor_t from , php_file_descriptor_t * to ,
810
+ static zend_result dup_proc_descriptor (php_file_descriptor_t from , php_file_descriptor_t * to ,
811
811
zend_ulong nindex )
812
812
{
813
813
#ifdef PHP_WIN32
@@ -827,7 +827,7 @@ static int dup_proc_descriptor(php_file_descriptor_t from, php_file_descriptor_t
827
827
return SUCCESS ;
828
828
}
829
829
830
- static int redirect_proc_descriptor (descriptorspec_item * desc , int target ,
830
+ static zend_result redirect_proc_descriptor (descriptorspec_item * desc , int target ,
831
831
descriptorspec_item * descriptors , int ndesc , int nindex )
832
832
{
833
833
php_file_descriptor_t redirect_to = PHP_INVALID_FD ;
@@ -863,15 +863,16 @@ static int redirect_proc_descriptor(descriptorspec_item *desc, int target,
863
863
}
864
864
865
865
/* Process one item from `$descriptorspec` argument to `proc_open` */
866
- static int set_proc_descriptor_from_array (zval * descitem , descriptorspec_item * descriptors ,
866
+ static zend_result set_proc_descriptor_from_array (zval * descitem , descriptorspec_item * descriptors ,
867
867
int ndesc , int nindex , int * pty_master_fd , int * pty_slave_fd ) {
868
868
zend_string * ztype = get_string_parameter (descitem , 0 , "handle qualifier" );
869
869
if (!ztype ) {
870
870
return FAILURE ;
871
871
}
872
872
873
873
zend_string * zmode = NULL , * zfile = NULL ;
874
- int retval = FAILURE ;
874
+ zend_result retval = FAILURE ;
875
+
875
876
if (zend_string_equals_literal (ztype , "pipe" )) {
876
877
/* Set descriptor to pipe */
877
878
zmode = get_string_parameter (descitem , 1 , "mode parameter for 'pipe'" );
@@ -923,7 +924,7 @@ static int set_proc_descriptor_from_array(zval *descitem, descriptorspec_item *d
923
924
return retval ;
924
925
}
925
926
926
- static int set_proc_descriptor_from_resource (zval * resource , descriptorspec_item * desc , int nindex )
927
+ static zend_result set_proc_descriptor_from_resource (zval * resource , descriptorspec_item * desc , int nindex )
927
928
{
928
929
/* Should be a stream - try and dup the descriptor */
929
930
php_stream * stream = (php_stream * )zend_fetch_resource (Z_RES_P (resource ), "stream" ,
@@ -933,7 +934,7 @@ static int set_proc_descriptor_from_resource(zval *resource, descriptorspec_item
933
934
}
934
935
935
936
php_socket_t fd ;
936
- int status = php_stream_cast (stream , PHP_STREAM_AS_FD , (void * * )& fd , REPORT_ERRORS );
937
+ zend_result status = php_stream_cast (stream , PHP_STREAM_AS_FD , (void * * )& fd , REPORT_ERRORS );
937
938
if (status == FAILURE ) {
938
939
return FAILURE ;
939
940
}
@@ -943,15 +944,11 @@ static int set_proc_descriptor_from_resource(zval *resource, descriptorspec_item
943
944
#else
944
945
php_file_descriptor_t fd_t = fd ;
945
946
#endif
946
- if (dup_proc_descriptor (fd_t , & desc -> childend , nindex ) == FAILURE ) {
947
- return FAILURE ;
948
- }
949
-
950
- return SUCCESS ;
947
+ return dup_proc_descriptor (fd_t , & desc -> childend , nindex );
951
948
}
952
949
953
950
#ifndef PHP_WIN32
954
- static int close_parentends_of_pipes (descriptorspec_item * descriptors , int ndesc )
951
+ static zend_result close_parentends_of_pipes (descriptorspec_item * descriptors , int ndesc )
955
952
{
956
953
/* We are running in child process
957
954
* Close the 'parent end' of pipes which were opened before forking/spawning
0 commit comments