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

40 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_master_c,v 1.2 2010/05/22 16:02:23 espie Exp $
--- src/master.c.orig Sat Jan 30 22:08:08 1999
+++ src/master.c Sat May 22 18:00:53 2010
@@ -7,6 +7,8 @@ master.c: network core for controlling nodes (node.c).
/////////////////////////////
#include "master.h"
+#include <stdlib.h>
+#include <string.h>
/////////////////////////////
@@ -56,7 +58,7 @@ int init( void )
strcpy( global.node[id]->ipstr, str );
global.node[id]->addr.sin_addr.s_addr = inet_addr(str);
fscanf(fp,"%s\n", str );
- global.node[id]->addr.sin_port = atoi(str);
+ global.node[id]->addr.sin_port = htons(atoi(str));
global.node[id]->addr.sin_family = AF_INET;
global.node[id]->socket = socket( AF_INET, SOCK_STREAM, 0 );
}
@@ -147,7 +149,7 @@ int main( int argc, u_char **argv )
{
print_handler("connecting to: %s %d: ",
global.node[id]->ipstr,
- global.node[id]->addr.sin_port );
+ ntohs(global.node[id]->addr.sin_port) );
if(!connect_node(id))
print_handler("connect failed.\n");
else
@@ -187,7 +189,7 @@ int main( int argc, u_char **argv )
{
print("closing connection: %s %d.\n",
global.node[id]->ipstr,
- global.node[id]->addr.sin_port );
+ ntohs(global.node[id]->addr.sin_port) );
disconnect_node(id);
}
}