mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00
further sync with libmagic.orig
This commit is contained in:
parent
f51d78a35d
commit
5b6427c40f
1 changed files with 11 additions and 1 deletions
|
@ -46,7 +46,12 @@ FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $")
|
||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
# ifndef HAVE_SIG_T
|
||||||
|
typedef void (*sig_t)(int);
|
||||||
|
# endif /* HAVE_SIG_T */
|
||||||
|
#endif
|
||||||
#ifndef PHP_WIN32
|
#ifndef PHP_WIN32
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,12 +112,16 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||||
size_t i, nsz;
|
size_t i, nsz;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
int mime = ms->flags & MAGIC_MIME;
|
int mime = ms->flags & MAGIC_MIME;
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
sig_t osigpipe;
|
sig_t osigpipe;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((ms->flags & MAGIC_COMPRESS) == 0)
|
if ((ms->flags & MAGIC_COMPRESS) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
osigpipe = signal(SIGPIPE, SIG_IGN);
|
osigpipe = signal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
for (i = 0; i < ncompr; i++) {
|
for (i = 0; i < ncompr; i++) {
|
||||||
if (nbytes < compr[i].maglen)
|
if (nbytes < compr[i].maglen)
|
||||||
continue;
|
continue;
|
||||||
|
@ -139,8 +148,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error:
|
error:
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
(void)signal(SIGPIPE, osigpipe);
|
(void)signal(SIGPIPE, osigpipe);
|
||||||
|
#endif
|
||||||
if (newbuf)
|
if (newbuf)
|
||||||
efree(newbuf);
|
efree(newbuf);
|
||||||
ms->flags |= MAGIC_COMPRESS;
|
ms->flags |= MAGIC_COMPRESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue