AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
-AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
+AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h)
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
AC_CHECK_HEADERS(zlib.h)
+AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.78 2015/01/02 21:29:39 christos Exp $")
#endif
#include "magic.h"
#endif
#include <string.h>
#include <errno.h>
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
+# ifndef HAVE_SIG_T
+typedef void (*sig_t)(int);
+# endif /* HAVE_SIG_T */
+#endif
#if !defined(__MINGW32__) && !defined(WIN32)
#include <sys/ioctl.h>
#endif
size_t i, nsz;
int rv = 0;
int mime = ms->flags & MAGIC_MIME;
+#ifdef HAVE_SIGNAL_H
sig_t osigpipe;
+#endif
if ((ms->flags & MAGIC_COMPRESS) == 0)
return 0;
+#ifdef HAVE_SIGNAL_H
osigpipe = signal(SIGPIPE, SIG_IGN);
+#endif
for (i = 0; i < ncompr; i++) {
if (nbytes < compr[i].maglen)
continue;
}
}
error:
+#ifdef HAVE_SIGNAL_H
(void)signal(SIGPIPE, osigpipe);
+#endif
free(newbuf);
ms->flags |= MAGIC_COMPRESS;
return rv;