From 17c8e77afa8a513f6ad5b5364a7928d3a9c18b6f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 14 Jan 2009 20:05:09 +0000 Subject: [PATCH] Merge some very simple points of divergence in the two copies of network.c -- enum ordering, whitespace, duplicate macro definitions, unused code, 0 vs NULL... git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21746 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/server/network.c | 17 ++++++++--------- src/kdc/network.c | 28 ++++++++++------------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/kadmin/server/network.c b/src/kadmin/server/network.c index d0f8afab8..14cfd46ad 100644 --- a/src/kadmin/server/network.c +++ b/src/kadmin/server/network.c @@ -1,7 +1,7 @@ /* * kadmin/server/network.c * - * Copyright 1990,2000,2007,2008 by the Massachusetts Institute of Technology. + * Copyright 1990,2000,2007,2008,2009 by the Massachusetts Institute of Technology. * * Export of this software from the United States of America may * require a specific license from the United States Government. @@ -180,13 +180,16 @@ static const char *paddr (struct sockaddr *sa) /* kadmin data. */ -enum kadm_conn_type { CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, - CONN_TCP, CONN_ROUTING, CONN_RPC_LISTENER, CONN_RPC }; +enum conn_type { + CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP, + CONN_RPC_LISTENER, CONN_RPC, + CONN_ROUTING +}; /* Per-connection info. */ struct connection { int fd; - enum kadm_conn_type type; + enum conn_type type; void (*service)(void *handle, struct connection *, const char *, int); union { /* Type-specific information. */ @@ -331,10 +334,6 @@ static krb5_error_code add_rpc_service(int port, u_long prognum, u_long versnum, return 0; } - -#define USE_AF AF_INET -#define USE_TYPE SOCK_DGRAM - #define USE_AF AF_INET #define USE_TYPE SOCK_DGRAM @@ -351,7 +350,7 @@ struct socksetup { }; static struct connection * -add_fd (struct socksetup *data, int sock, enum kadm_conn_type conntype, +add_fd (struct socksetup *data, int sock, enum conn_type conntype, void (*service)(void *handle, struct connection *, const char *, int)) { struct connection *newconn; diff --git a/src/kdc/network.c b/src/kdc/network.c index 98f074cce..56799522c 100644 --- a/src/kdc/network.c +++ b/src/kdc/network.c @@ -1,7 +1,7 @@ /* * kdc/network.c * - * Copyright 1990,2000,2007,2008 by the Massachusetts Institute of Technology. + * Copyright 1990,2000,2007,2008,2009 by the Massachusetts Institute of Technology. * * Export of this software from the United States of America may * require a specific license from the United States Government. @@ -175,26 +175,18 @@ static const char *paddr (struct sockaddr *sa) /* KDC data. */ -enum kdc_conn_type { CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP, CONN_ROUTING }; +enum conn_type { + CONN_UDP, CONN_UDP_PKTINFO, CONN_TCP_LISTENER, CONN_TCP, + CONN_ROUTING +}; /* Per-connection info. */ struct connection { int fd; - enum kdc_conn_type type; + enum conn_type type; void (*service)(struct connection *, const char *, int); union { /* Type-specific information. */ -#if 0 - struct { - int x; - } udp; - struct { - int x; - } udp_pktinfo; - struct { - int x; - } tcp_listener; -#endif struct { /* connection */ struct sockaddr_storage addr_s; @@ -316,7 +308,7 @@ struct socksetup { }; static struct connection * -add_fd (struct socksetup *data, int sock, enum kdc_conn_type conntype, +add_fd (struct socksetup *data, int sock, enum conn_type conntype, void (*service)(struct connection *, const char *, int)) { struct connection *newconn; @@ -527,7 +519,7 @@ setup_tcp_listener_ports(struct socksetup *data) /* Sockets are created, prepare to listen on them. */ if (s4 >= 0) { - if (add_tcp_listener_fd(data, s4) == 0) + if (add_tcp_listener_fd(data, s4) == NULL) close(s4); else { FD_SET(s4, &sstate.rfds); @@ -539,7 +531,7 @@ setup_tcp_listener_ports(struct socksetup *data) } #ifdef KRB5_USE_INET6 if (s6 >= 0) { - if (add_tcp_listener_fd(data, s6) == 0) { + if (add_tcp_listener_fd(data, s6) == NULL) { close(s6); s6 = -1; } else { @@ -1306,7 +1298,7 @@ static void accept_tcp_connection(struct connection *conn, const char *prog, sockdata.retval = 0; newconn = add_tcp_data_fd(&sockdata, s); - if (newconn == 0) + if (newconn == NULL) return; if (getnameinfo((struct sockaddr *)&addr_s, addrlen, -- 2.26.2