2005-01-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ripd.c: (rip_create_socket) Save errno before calling
ripd_privs.change.
diff --git a/ripd/ripd.c b/ripd/ripd.c
index c5baf8a..2a345a6 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -2002,9 +2002,11 @@
ret = bind (sock, (struct sockaddr *) & addr, sizeof (addr));
if (ret < 0)
{
- perror ("bind");
+ int save_errno = errno;
if (ripd_privs.change (ZPRIVS_LOWER))
zlog_err ("rip_create_socket: could not lower privs");
+ zlog_err("cannot bind to port %d: %s",
+ (int)ntohs(addr.sin_port), safe_strerror(save_errno));
return ret;
}
if (ripd_privs.change (ZPRIVS_LOWER))