#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.81 2013/11/29 15:42:51 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.82 2014/05/13 16:38:23 christos Exp $")
#endif /* lint */
#include "magic.h"
int ispipe = 0;
off_t pos = (off_t)-1;
+ if (file_reset(ms) == -1)
+ goto out;
+
/*
* one extra for terminating '\0', and
* some overlapping space for matches near EOF
if ((buf = CAST(unsigned char *, malloc(HOWMANY + SLOP))) == NULL)
return NULL;
- if (file_reset(ms) == -1)
- goto done;
-
switch (file_fsmagic(ms, inname, &sb)) {
case -1: /* error */
goto done;
if (pos != (off_t)-1)
(void)lseek(fd, pos, SEEK_SET);
close_and_restore(ms, inname, fd, &sb);
+out:
return rv == 0 ? file_getbuffer(ms) : NULL;
}