diff options
author | ajs <ajs> | 2005-02-16 20:40:25 +0000 |
---|---|---|
committer | ajs <ajs> | 2005-02-16 20:40:25 +0000 |
commit | 33df746b2d917efdfa95cff909be525584281241 (patch) | |
tree | 242e82860c6f17dcfbead5d2062415d80ec7d434 | |
parent | 3f432fb4eb920b72e5403e128b02d341abcb3d76 (diff) | |
download | quagga-33df746b2d917efdfa95cff909be525584281241.tar.bz2 quagga-33df746b2d917efdfa95cff909be525584281241.tar.xz |
2005-02-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* watchquagga.c: (try_connect) Use new set_nonblocking function instead
of calling fcntl directly.
-rw-r--r-- | watchquagga/ChangeLog | 5 | ||||
-rw-r--r-- | watchquagga/watchquagga.c | 16 |
2 files changed, 9 insertions, 12 deletions
diff --git a/watchquagga/ChangeLog b/watchquagga/ChangeLog index 20f974ef..79261c26 100644 --- a/watchquagga/ChangeLog +++ b/watchquagga/ChangeLog @@ -1,3 +1,8 @@ +2005-02-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * watchquagga.c: (try_connect) Use new set_nonblocking function instead + of calling fcntl directly. + 2005-01-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * watchquagga.c: (run_job) Fix bug: delay.tv_sec was being used diff --git a/watchquagga/watchquagga.c b/watchquagga/watchquagga.c index 23106037..3f13b9cf 100644 --- a/watchquagga/watchquagga.c +++ b/watchquagga/watchquagga.c @@ -23,6 +23,7 @@ #include <zebra.h> #include <thread.h> #include <log.h> +#include <network.h> #include <sigevent.h> #include <lib/version.h> #include <getopt.h> @@ -733,7 +734,6 @@ try_connect(struct daemon *dmn) int sock; struct sockaddr_un addr; socklen_t len; - int flags; if (gs.loglevel > LOG_DEBUG+1) zlog_debug("%s: attempting to connect",dmn->name); @@ -766,18 +766,10 @@ try_connect(struct daemon *dmn) return -1; } - /* Set non-blocking. */ - if ((flags = fcntl(sock, F_GETFL, 0)) < 0) + if (set_nonblocking(sock) < 0) { - zlog_err("%s(%s): fcntl(F_GETFL) failed: %s", - __func__,addr.sun_path, safe_strerror(errno)); - close(sock); - return -1; - } - if (fcntl(sock, F_SETFL, (flags|O_NONBLOCK)) < 0) - { - zlog_err("%s(%s): fcntl(F_SETFL,O_NONBLOCK) failed: %s", - __func__,addr.sun_path, safe_strerror(errno)); + zlog_err("%s(%s): set_nonblocking(%d) failed", + __func__, addr.sun_path, sock); close(sock); return -1; } |