* .gnulib: Update to latest, for sigpipe and sigaction modules.
* bootstrap.conf (gnulib_modules): Add siaction, sigpipe, strerror_r.
* tools/virsh.c (vshSetupSignals) [!SIGPIPE]: Delete, now that
gnulib guarantees it.
(SA_SIGINFO): Define for mingw fallback.
* src/util/virterror.c (virStrerror): Simplify, now that gnulib
guarantees the POSIX interface.
* configure.ac (AC_CHECK_FUNCS_ONCE): Drop redundant check.
(AM_PROG_CC_STDC): Move earlier, to keep autoconf happy.
-Subproject commit 9779055889c2715b593930e39ead552759b5ddc2
+Subproject commit 45d39ca1cae74fcf58ec9911e771bc8baca63f66
sched
send
setsockopt
+sigaction
+sigpipe
snprintf
socket
stpcpy
strchrnul
strndup
strerror
+strerror_r-posix
strptime
strsep
strtok_r
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP
+AM_PROG_CC_STDC
gl_EARLY
gl_INIT
-AM_PROG_CC_STDC
AC_TYPE_UID_T
dnl Make sure we have an ANSI compiler
AC_MSG_RESULT([$have_cpuid])
-dnl Availability of various common functions (non-fatal if missing).
-AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid initgroups \
- posix_fallocate mmap])
-
-dnl Availability of various not common threadsafe functions
-AC_CHECK_FUNCS_ONCE([strerror_r getmntent_r getgrnam_r getpwuid_r])
+dnl Availability of various common functions (non-fatal if missing),
+dnl and various less common threadsafe functions
+AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid \
+ initgroups posix_fallocate mmap \
+ getmntent_r getgrnam_r getpwuid_r])
dnl Availability of pthread functions (if missing, win32 threading is
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
* @errBuf: the buffer to save the error to
* @errBufLen: the buffer length
*
- * Generate an erro string for the given errno
+ * Generate an error string for the given errno
*
* Returns a pointer to the error string, possibly indicating that the
* error is unknown
int save_errno = errno;
const char *ret;
-#ifdef HAVE_STRERROR_R
-# ifdef __USE_GNU
- /* Annoying linux specific API contract */
- ret = strerror_r(theerrno, errBuf, errBufLen);
-# else
strerror_r(theerrno, errBuf, errBufLen);
ret = errBuf;
-# endif
-#else
- /* Mingw lacks strerror_r and its strerror is definitely not
- * threadsafe, so safest option is to just print the raw errno
- * value - we can at least reliably & safely look it up in the
- * header files for debug purposes
- */
- int n = snprintf(errBuf, errBufLen, "errno=%d", theerrno);
- ret = (0 < n && n < errBufLen
- ? errBuf : _("internal error: buffer too small"));
-#endif
errno = save_errno;
return ret;
}
*/
static int disconnected = 0; /* we may have been disconnected */
-#ifdef SIGPIPE
+/* Gnulib doesn't guarantee SA_SIGINFO support. */
+#ifndef SA_SIGINFO
+# define SA_SIGINFO 0
+#endif
+
/*
* vshCatchDisconnect:
*
* We get here when a SIGPIPE is being raised, we can't do much in the
* handler, just save the fact it was raised
*/
-static void vshCatchDisconnect(int sig, siginfo_t * siginfo,
- void* context ATTRIBUTE_UNUSED) {
- if ((sig == SIGPIPE) || (siginfo->si_signo == SIGPIPE))
+static void vshCatchDisconnect(int sig, siginfo_t *siginfo,
+ void *context ATTRIBUTE_UNUSED) {
+ if ((sig == SIGPIPE) ||
+ (SA_SIGINFO && siginfo->si_signo == SIGPIPE))
disconnected++;
}
sigaction(SIGPIPE, &sig_action, NULL);
}
-#else
-static void
-vshSetupSignals(void) {}
-#endif
/*
* vshReconnect: