From ff0fe17725d4f2de6caa1ec3abd1e780e3474e61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 17 Mar 2011 22:21:59 +0000 Subject: [PATCH] - Replaced calls to getprotobyname by constants to avoid unnecessarily hitting /etc/protocols on MINIT. --- ext/sockets/sockets.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index a180c86c6e..421e01c9ae 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -815,14 +815,9 @@ PHP_MINIT_FUNCTION(sockets) #if HAVE_IPV6 REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); #endif - - if ((pe = getprotobyname("tcp"))) { - REGISTER_LONG_CONSTANT("SOL_TCP", pe->p_proto, CONST_CS | CONST_PERSISTENT); - } - if ((pe = getprotobyname("udp"))) { - REGISTER_LONG_CONSTANT("SOL_UDP", pe->p_proto, CONST_CS | CONST_PERSISTENT); - } + REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); return SUCCESS; } -- 2.40.0