]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Return 0 on error, not -1
authorAlan T. DeKok <aland@freeradius.org>
Thu, 23 Apr 2009 15:14:46 +0000 (17:14 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 23 Apr 2009 15:14:46 +0000 (17:14 +0200)
src/main/command.c

index 210294ecdbef8a66ef17f52285d69579a2e8e336..50843b245e4e23f856b15fd7878115cd6d6a0a8f 100644 (file)
@@ -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