diff options
author | Grzegorz Nosek <root@localdomain.pl> | 2015-04-19 11:14:03 +0200 |
---|---|---|
committer | Grzegorz Nosek <root@localdomain.pl> | 2015-04-19 11:14:03 +0200 |
commit | d9c6cf5cdcdf18dcacd184f587324a10be5027f7 (patch) | |
tree | 45e53518ed674932fc2b64f89fc0c056e8ee356e | |
parent | deabe97f2108edb5715dfc4ab4609514bf3d8157 (diff) | |
download | fcgiwrap-d9c6cf5cdcdf18dcacd184f587324a10be5027f7.tar.xz fcgiwrap-d9c6cf5cdcdf18dcacd184f587324a10be5027f7.zip |
Return the new fd directly from setup_socket()
We either have a proper descriptor (>0) or an error (<0)
so we don't strictly need the fd_out parameter
-rw-r--r-- | fcgiwrap.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -704,7 +704,7 @@ static int listen_on_fd(int fd) { return 0; } -static int setup_socket(char *url, int *fd_out) { +static int setup_socket(char *url) { char *p = url; char *q; int fd; @@ -784,8 +784,11 @@ invalid_url: return -1; } - *fd_out = fd; - return listen_on_fd(fd); + if (listen_on_fd(fd) < 0) { + return -1; + } + + return fd; } int main(int argc, char **argv) @@ -850,7 +853,8 @@ int main(int argc, char **argv) } else #endif if (socket_url) { - if (setup_socket(socket_url, &fd) < 0) { + fd = setup_socket(socket_url); + if (fd < 0) { return 1; } } |