summaryrefslogtreecommitdiffstats
path: root/lib/vty.c
diff options
context:
space:
mode:
authorpaul <paul>2004-10-31 02:13:09 +0000
committerpaul <paul>2004-10-31 02:13:09 +0000
commit7d4810e60eccd504ab02ee6e090648341346a2be (patch)
tree82f04f0267199c4b276815fa98a8ee56ca9b6ed9 /lib/vty.c
parent657cae3dc6892fc075c8f43af9e0adda6b6fe29d (diff)
downloadquagga-7d4810e60eccd504ab02ee6e090648341346a2be.tar.bz2
quagga-7d4810e60eccd504ab02ee6e090648341346a2be.tar.xz
2004-10-31 Paul Jakma <paul@dishone.st>
* vty.c: As per Andrew's suggestions.. (vty_serv_un) remove flags. (vtysh_accept) close socket if we cant set NONBLOCK. Add flags.
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 7db1aa91..e37c99f5 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1857,7 +1857,7 @@ void
vty_serv_un (const char *path)
{
int ret;
- int sock, len, flags;
+ int sock, len;
struct sockaddr_un serv;
mode_t old_mask;
struct zprivs_ids_t ids;
@@ -1927,6 +1927,7 @@ vtysh_accept (struct thread *thread)
int accept_sock;
int sock;
int client_len;
+ int flags;
struct sockaddr_un client;
struct vty *vty;
@@ -1949,8 +1950,12 @@ vtysh_accept (struct thread *thread)
/* 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));
+ {
+ zlog_warn ("vtysh_accept: could not set vty socket to non-blocking,"
+ " %s, closing", strerror (errno));
+ close (sock);
+ return -1;
+ }
#ifdef VTYSH_DEBUG
printf ("VTY shell accept\n");