Re: [PHP-DEV] CVS update: php3/doc/functions From: Michael Graff (explorer <email protected>)
Date: 05/30/98

rasmus <php-dev <email protected>> writes:

> Modified Files:
> network.sgml
> Log Message:
> Clean up return code from fsockopen() and add two optional arguments.
> $errno and $errstr which get set to the system-level errno and strerror()
> from the connect() call.

Super!

I think this is needed though, since you won't want to free() the
value returned by strerror():

Index: functions/fsock.c
===================================================================
RCS file: /repository/php3/functions/fsock.c,v
retrieving revision 1.72
diff -u -r1.72 fsock.c
--- fsock.c 1998/05/30 22:17:48 1.72
+++ fsock.c 1998/05/30 22:49:05
@@ -160,7 +160,7 @@
                         FREE_SOCK;
                         if(arg_count>2) args[2]->value.lval = errno;
                         if(arg_count>3) {
- args[3]->value.str.val = strerror(errno);
+ args[3]->value.str.val = estrdup(strerror(errno));
                                 args[3]->value.str.len = strlen(args[3]->value.str.val);
                         }
                         RETURN_FALSE;