From: Ezra Peisach Date: Mon, 7 Jun 2004 19:25:32 +0000 (+0000) Subject: * network.c (paddr): Use unsigned int for length. X-Git-Tag: krb5-1.4-beta1~356 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b7d2088661c5db832ff1cef008dc92306b6d465f;p=krb5.git * network.c (paddr): Use unsigned int for length. (kdc_conn_type): Declare CONN_ enumerated types in connection as distinct type. (add_fd): Declare as taking enum type instead of simply integer. Prevents assignment of interger to an enum. (process_tcp_connection): Remove variable assigned to but never used. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16416 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kdc/ChangeLog b/src/kdc/ChangeLog index 2fbf055de..968dfa45a 100644 --- a/src/kdc/ChangeLog +++ b/src/kdc/ChangeLog @@ -1,3 +1,12 @@ +2004-06-07 Ezra Peisach + + * network.c (paddr): Use unsigned int for length. + (kdc_conn_type): Declare CONN_ enumerated types in connection as + distinct type. + (add_fd): Declare as taking enum type instead of simply + integer. Prevents assignment of interger to an enum. + (process_tcp_connection): Remove variable assigned to but never used. + 2004-05-05 Ken Raeburn * network.c: Include foreachaddr.h, not foreachaddr.c. diff --git a/src/kdc/network.c b/src/kdc/network.c index e55efac93..a7bfbc8fa 100644 --- a/src/kdc/network.c +++ b/src/kdc/network.c @@ -126,7 +126,7 @@ static const char *paddr (struct sockaddr *sa) NI_NUMERICHOST|NI_NUMERICSERV)) strcpy(buf, ""); else { - int len = sizeof(buf) - strlen(buf); + unsigned int len = sizeof(buf) - strlen(buf); char *p = buf + strlen(buf); if (len > 2+strlen(portbuf)) { *p++ = '.'; @@ -139,10 +139,12 @@ static const char *paddr (struct sockaddr *sa) /* KDC data. */ +enum kdc_conn_type { CONN_UDP, CONN_TCP_LISTENER, CONN_TCP }; + /* Per-connection info. */ struct connection { int fd; - enum { CONN_UDP, CONN_TCP_LISTENER, CONN_TCP } type; + enum kdc_conn_type type; void (*service)(struct connection *, const char *, int); union { /* Type-specific information. */ @@ -270,7 +272,7 @@ struct socksetup { }; static struct connection * -add_fd (struct socksetup *data, int sock, int conntype, +add_fd (struct socksetup *data, int sock, enum kdc_conn_type conntype, void (*service)(struct connection *, const char *, int)) { struct connection *newconn; @@ -895,12 +897,10 @@ process_tcp_connection(struct connection *conn, const char *prog, int selflags) if (selflags & SSF_WRITE) { ssize_t nwrote; SOCKET_WRITEV_TEMP tmp; - krb5_error_code e; nwrote = SOCKET_WRITEV(conn->fd, conn->u.tcp.sgp, conn->u.tcp.sgnum, tmp); if (nwrote < 0) { - e = SOCKET_ERRNO; goto kill_tcp_connection; } if (nwrote == 0)