summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2018-10-01 18:43:01 +0000
committerChristos Zoulas <christos@zoulas.com>2018-10-01 18:43:01 +0000
commit6a9f7e718c8bfe74f89c715920d745974f408657 (patch)
treeec020a992104c6c5a92e912cffe8a248e548bbc7
parent0ef88ba22b02571767dc106e8e41e8402970f5ea (diff)
downloadfile-git-6a9f7e718c8bfe74f89c715920d745974f408657.tar.gz
signal.h is part of c89, remove testing for it.
-rw-r--r--configure.ac7
-rw-r--r--src/compress.c14
2 files changed, 5 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index ab4f6fc2..72d69ed6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,15 +92,12 @@ AC_HEADER_MAJOR
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 signal.h)
+AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
if test "$enable_zlib" != "no"; then
AC_CHECK_HEADERS(zlib.h)
fi
-AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif])
+AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/src/compress.c b/src/compress.c
index 041ba4c6..f7d9d1c1 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.111 2018/09/11 16:33:21 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.112 2018/10/01 18:43:01 christos Exp $")
#endif
#include "magic.h"
@@ -47,12 +47,10 @@ FILE_RCSID("@(#)$File: compress.c,v 1.111 2018/09/11 16:33:21 christos Exp $")
#include <errno.h>
#include <ctype.h>
#include <stdarg.h>
-#ifdef HAVE_SIGNAL_H
#include <signal.h>
-# ifndef HAVE_SIG_T
+#ifndef HAVE_SIG_T
typedef void (*sig_t)(int);
-# endif /* HAVE_SIG_T */
-#endif
+#endif /* HAVE_SIG_T */
#if !defined(__MINGW32__) && !defined(WIN32)
#include <sys/ioctl.h>
#endif
@@ -228,16 +226,12 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
int fd = b->fd;
const unsigned char *buf = b->fbuf;
size_t nbytes = b->flen;
-#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++) {
int zm;
if (nbytes < compr[i].maglen)
@@ -308,9 +302,7 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
out:
DPRINTF("rv = %d\n", rv);
-#ifdef HAVE_SIGNAL_H
(void)signal(SIGPIPE, osigpipe);
-#endif
free(newbuf);
ms->flags |= MAGIC_COMPRESS;
DPRINTF("Zmagic returns %d\n", rv);