CVS update: php3/functions
| From: | sas | Date: | Thu, 21 Jan 1999 21:20:23 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3678@lists.php.net to get a copy of this message | ||
Date: Thursday January 21, 1999 @ 16:20
Author: sas
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv4465/functions
Modified Files:
fsock.c fsock.h
Log Message:
Using inet_addr() is deprecated. And even if it's used, it should
compare with INADDR_NONE, not with -1.
Index: php3/functions/fsock.c
diff -c php3/functions/fsock.c:1.77 php3/functions/fsock.c:1.78
*** php3/functions/fsock.c:1.77 Fri Jan 1 12:59:10 1999
--- php3/functions/fsock.c Thu Jan 21 16:20:23 1999
***************
*** 27,33 ****
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.c,v 1.77 1999/01/01 17:59:10 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 27,33 ----
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.c,v 1.78 1999/01/21 21:20:23 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 81,101 ****
/*
* Converts a host name to an IP address.
*/
! int lookup_hostname(const char *addr)
{
- uint r;
struct hostent *host_info;
! r = inet_addr(addr);
! if (r == (uint) - 1) {
host_info = gethostbyname(addr);
if (host_info == 0) {
/* Error: unknown host */
return -1;
}
! memcpy((char *) &r, host_info->h_addr, host_info->h_length);
}
! return r;
}
/*
--- 81,99 ----
/*
* Converts a host name to an IP address.
*/
! int lookup_hostname(const char *addr, struct in_addr *in)
{
struct hostent *host_info;
! if(!inet_aton(addr, in)) {
host_info = gethostbyname(addr);
if (host_info == 0) {
/* Error: unknown host */
return -1;
}
! *in = *((struct in_addr *) host_info->h_addr);
}
! return 0;
}
/*
***************
*** 148,157 ****
RETURN_FALSE;
}
- server.sin_addr.s_addr = lookup_hostname(args[0]->value.str.val);
server.sin_family = AF_INET;
! if (server.sin_addr.s_addr == -1) {
FREE_SOCK;
RETURN_FALSE;
}
--- 146,154 ----
RETURN_FALSE;
}
server.sin_family = AF_INET;
! if (lookup_hostname(args[0]->value.str.val, &server.sin_addr)) {
FREE_SOCK;
RETURN_FALSE;
}
Index: php3/functions/fsock.h
diff -c php3/functions/fsock.h:1.14 php3/functions/fsock.h:1.15
*** php3/functions/fsock.h:1.14 Fri Jan 1 12:59:10 1999
--- php3/functions/fsock.h Thu Jan 21 16:20:23 1999
***************
*** 27,39 ****
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.h,v 1.14 1999/01/01 17:59:10 zeev Exp $ */
#ifndef _FSOCK_H
#define _FSOCK_H
extern void php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS);
! extern int lookup_hostname(const char *addr);
extern int _php3_sock_fgets(char *buf, int maxlen, int socket);
extern int _php3_sock_fread(char *buf, int maxlen, int socket);
--- 27,39 ----
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.h,v 1.15 1999/01/21 21:20:23 sas Exp $ */
#ifndef _FSOCK_H
#define _FSOCK_H
extern void php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS);
! extern int lookup_hostname(const char *addr, struct in_addr *in);
extern int _php3_sock_fgets(char *buf, int maxlen, int socket);
extern int _php3_sock_fread(char *buf, int maxlen, int socket);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net