From: Alan T. DeKok Date: Thu, 23 Apr 2009 15:14:46 +0000 (+0200) Subject: Return 0 on error, not -1 X-Git-Tag: release_2_1_7~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa084b0b2f361a9ea13b18c124a04b6dc881e0ee;p=thirdparty%2Ffreeradius-server.git Return 0 on error, not -1 --- diff --git a/src/main/command.c b/src/main/command.c index 210294ecdbe..50843b245e4 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -2072,6 +2072,9 @@ static int command_domain_accept(rad_listen_t *listener, salen = sizeof(src); DEBUG2(" ... new connection request on command socket."); + + *pfun = NULL; + *prequest = NULL; newfd = accept(listener->fd, (struct sockaddr *) &src, &salen); if (newfd < 0) { @@ -2083,7 +2086,7 @@ static int command_domain_accept(rad_listen_t *listener, } DEBUG2(" ... failed to accept connection."); - return -1; + return 0; } /* @@ -2097,21 +2100,21 @@ static int command_domain_accept(rad_listen_t *listener, radlog(L_ERR, "Failed getting peer credentials for %s: %s", sock->path, strerror(errno)); close(newfd); - return -1; + return 0; } if (sock->uid_name && (sock->uid != uid)) { radlog(L_ERR, "Unauthorized connection to %s from uid %ld", sock->path, (long int) uid); close(newfd); - return -1; + return 0; } if (sock->gid_name && (sock->gid != gid)) { radlog(L_ERR, "Unauthorized connection to %s from gid %ld", sock->path, (long int) gid); close(newfd); - return -1; + return 0; } } @@ -2123,14 +2126,14 @@ static int command_domain_accept(rad_listen_t *listener, radlog(L_ERR, "Failed writing initial data to socket: %s", strerror(errno)); close(newfd); - return -1; + return 0; } magic = htonl(1); /* protocol version */ if (write(newfd, &magic, 4) < 0) { radlog(L_ERR, "Failed writing initial data to socket: %s", strerror(errno)); close(newfd); - return -1; + return 0; } @@ -2138,7 +2141,7 @@ static int command_domain_accept(rad_listen_t *listener, * Add the new listener. */ this = listen_alloc(listener->type); - if (!this) return -1; + if (!this) return 0; /* * Copy everything, including the pointer to the socket