#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.67 2011/09/01 12:12:37 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.68 2011/12/08 12:38:24 rrt Exp $")
#endif
#include "magic.h"
* `safe' read for sockets and pipes.
*/
protected ssize_t
-sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
+sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
{
ssize_t rv;
-#ifdef FD_ZERO
- ssize_t cnt;
-#endif
#ifdef FIONREAD
int t = 0;
#endif
goto nocheck;
#ifdef FIONREAD
- if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {
+ if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
#ifdef FD_ZERO
+ ssize_t cnt;
for (cnt = 0;; cnt++) {
fd_set check;
struct timeval tout = {0, 100 * 1000};
char buf[4096];
ssize_t r;
int tfd;
-#ifdef HAVE_MKSTEMP
- int te;
-#endif
(void)strlcpy(buf, "/tmp/file.XXXXXX", sizeof buf);
#ifndef HAVE_MKSTEMP
errno = r;
}
#else
- tfd = mkstemp(buf);
- te = errno;
- (void)unlink(buf);
- errno = te;
+ {
+ int te;
+ tfd = mkstemp(buf);
+ te = errno;
+ (void)unlink(buf);
+ errno = te;
+ }
#endif
if (tfd == -1) {
file_error(ms, errno,