Skip to contentSkip to conversation

mount: refactor error handling in get_socket()

PATCH New Chuck Lever 1 participant 1 message Feb 18, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/17 mount: refactor error handling in get_socket()

Refactor get_socket's error-handling exits. This makes it cleaner to add IPv6 address support to the error messages.

Note that we moved the socket close(2) out of mainline get_socket() for the error cases. We must preserve the order of referencing errno before calling close(2), so that close(2) doesn't tromp on errno before we can report the value set by the failing call.

---

 configure.ac          |    1 
 utils/mount/network.c |  146 ++++++++++++++++++++++++++++++-------------------
 2 files changed, 91 insertions(+), 56 deletions(-)
configure.ac +1 -0
index 233cd57..3e600b4 100644
@@ -297,6 +297,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
 have_bindresvport6=none
 if test "$enable_ipv6" = yes; then
     AC_CHECK_FUNC(bindresvport6, [have_bindresvport6=lib])
+    AC_CHECK_FUNC(inet_ntop, , , AC_MSG_ERROR(Function 'inet_ntop' not found.))
 fi
 AM_CONDITIONAL(CONFIG_BRP6, [test "$have_bindresvport6" = "none"])
 
utils/mount/network.c +90 -56

172 lines not on this page · raw message