From c0618de64ca81b9f1f2fd05e43c24f155234b451 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 18 Aug 2004 21:52:58 +0000 Subject: 2004-08-18 Paul Jakma * vty.c: (vty_serv_un) set unix vty socket to nonblocking to prevent inadvertent blocking of daemons by use of vtysh. TODO: disentangle manual paging from the buffer_write path so that unix vty can use this path too and be reliable. --- lib/ChangeLog | 7 +++++++ lib/vty.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ChangeLog b/lib/ChangeLog index 4540456a..421a4f0b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,10 @@ +2004-08-18 Paul Jakma + + * vty.c: (vty_serv_un) set unix vty socket to nonblocking + to prevent inadvertent blocking of daemons by use of + vtysh. TODO: disentangle manual paging from the buffer_write + path so that unix vty can use this path too and be reliable. + 2004-07-23 Greg Troxel * sockopt.c (getsockopt_ipv4_pktinfo_ifindex): Make this compile diff --git a/lib/vty.c b/lib/vty.c index 761ca4c2..b1c96f37 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -1856,7 +1856,7 @@ void vty_serv_un (char *path) { int ret; - int sock, len; + int sock, len, flags; struct sockaddr_un serv; mode_t old_mask; struct zprivs_ids_t ids; @@ -1901,6 +1901,12 @@ vty_serv_un (char *path) return; } + /* set to non-blocking*/ + if ( ((flags = fcntl (sock, F_GETFL)) == -1) + || (fcntl (sock, F_SETFL, flags|O_NONBLOCK) == -1) ) + zlog_warn ("vty_serv_un: could not set vty socket to non-blocking," + " %s", strerror (errno)); + umask (old_mask); zprivs_get_ids(&ids); -- cgit v1.2.1