openbsd-ports/security/slurpie/patches/patch-src_node_c
2010-05-22 16:02:23 +00:00

38 lines
1.3 KiB
Plaintext

$OpenBSD: patch-src_node_c,v 1.2 2010/05/22 16:02:23 espie Exp $
--- src/node.c.orig Sat Jan 30 22:10:17 1999
+++ src/node.c Sat May 22 18:01:33 2010
@@ -8,6 +8,8 @@ node.c: network core for serving the master (master.c)
/////////////////////////////
#include "node.h"
+#include <string.h>
+#include <stdlib.h>
/////////////////////////////
@@ -49,7 +51,7 @@ int init( void )
global.self.addr.sin_family = AF_INET;
global.self.addr.sin_addr.s_addr = INADDR_ANY;
if( !global.self.addr.sin_port )
- global.self.addr.sin_port = DEFAULT_PORT; // no port chosen, use default
+ global.self.addr.sin_port = htons(DEFAULT_PORT); // no port chosen, use default
global.self.sa_len = sizeof(global.self.addr);
if( bind( global.self.socket,
@@ -111,12 +113,13 @@ int main( int argc, u_char **argv )
if(!commline_handler(argc,argv))
clean_up(1);
if(!init())
- error("could not initialize on port: %d\n", global.self.addr.sin_port );
+ error("could not initialize on port: %d\n",
+ ntohs(global.self.addr.sin_port) );
while(!exit_state)
{
// sleep
- print_handler("listening on: %d\n", global.self.addr.sin_port );
+ print_handler("listening on: %d\n", ntohs(global.self.addr.sin_port) );
sleep_mode();
// awake
print_handler("master connected at %s.\n",