diff --git a/.gnulib b/.gnulib index 9779055889c2715b593930e39ead552759b5ddc2..45d39ca1cae74fcf58ec9911e771bc8baca63f66 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 9779055889c2715b593930e39ead552759b5ddc2 +Subproject commit 45d39ca1cae74fcf58ec9911e771bc8baca63f66 diff --git a/bootstrap.conf b/bootstrap.conf index a55fca25f244d6f3be1dd3965ff7ad3bbbb77e9b..88832d163fe53f1c9913d6013c9b0d3e98923b2a 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -58,12 +58,15 @@ random_r sched send setsockopt +sigaction +sigpipe snprintf socket stpcpy strchrnul strndup strerror +strerror_r-posix strptime strsep strtok_r diff --git a/configure.ac b/configure.ac index 337ce17d2ead3ed729b7e2392c2f67ca4fd93887..f310a5e814113dd3633426c16118e2c61120fac1 100644 --- a/configure.ac +++ b/configure.ac @@ -49,11 +49,11 @@ dnl Checks for C compiler. 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 @@ -93,12 +93,11 @@ fi 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. diff --git a/src/util/virterror.c b/src/util/virterror.c index 75436032c09e834a2e6ec8d796f007d6620d67ca..3dd6256f50ff6152b81e96d1770a972f433d81c5 100644 --- a/src/util/virterror.c +++ b/src/util/virterror.c @@ -1250,7 +1250,7 @@ void virReportErrorHelper(virConnectPtr conn, * @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 @@ -1260,24 +1260,8 @@ const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen) 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; } diff --git a/tools/virsh.c b/tools/virsh.c index 5b26c78ac54589a97455ead0814c0a32734bd02c..aba794520b4d04dde060977ddea85d4e48dce5c4 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -497,16 +497,21 @@ out: */ 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++; } @@ -526,10 +531,6 @@ vshSetupSignals(void) { sigaction(SIGPIPE, &sig_action, NULL); } -#else -static void -vshSetupSignals(void) {} -#endif /* * vshReconnect: