Quiet a compiler warning on some platforms.

This commit is contained in:
Todd C. Miller
2011-05-27 13:50:37 -04:00
parent 9b7cd235e7
commit 3e2f4037cc

View File

@@ -199,7 +199,7 @@ static void check_input(int, double *);
static void delay(double); static void delay(double);
static void help(void) __attribute__((__noreturn__)); static void help(void) __attribute__((__noreturn__));
static void usage(int); static void usage(int);
static void *open_io_fd(char *pathbuf, int len, const char *suffix); static int open_io_fd(char *pathbuf, int len, const char *suffix, union io_fd *fdp);
static int parse_timing(const char *buf, const char *decimal, int *idx, double *seconds, size_t *nbytes); static int parse_timing(const char *buf, const char *decimal, int *idx, double *seconds, size_t *nbytes);
#ifdef HAVE_REGCOMP #ifdef HAVE_REGCOMP
@@ -321,8 +321,7 @@ main(int argc, char *argv[])
/* Open files for replay, applying replay filter for the -f flag. */ /* Open files for replay, applying replay filter for the -f flag. */
for (idx = 0; idx < IOFD_MAX; idx++) { for (idx = 0; idx < IOFD_MAX; idx++) {
if (ISSET(replay_filter, 1 << idx) || idx == IOFD_TIMING) { if (ISSET(replay_filter, 1 << idx) || idx == IOFD_TIMING) {
io_fds[idx].v = open_io_fd(path, plen, io_fnames[idx]); if (open_io_fd(path, plen, io_fnames[idx], &io_fds[idx]) == -1)
if (io_fds[idx].v == NULL)
error(1, _("unable to open %s"), path); error(1, _("unable to open %s"), path);
} }
} }
@@ -458,16 +457,18 @@ delay(double secs)
} }
} }
static void * static int
open_io_fd(char *path, int len, const char *suffix) open_io_fd(char *path, int len, const char *suffix, union io_fd *fdp)
{ {
path[len] = '\0'; path[len] = '\0';
strlcat(path, suffix, PATH_MAX); strlcat(path, suffix, PATH_MAX);
#ifdef HAVE_ZLIB_H #ifdef HAVE_ZLIB_H
return gzopen(path, "r"); fdp->g = gzopen(path, "r");
return fdp->g ? 0 : -1;
#else #else
return fopen(path, "r"); fdp->f = fopen(path, "r");
return fdp->f ? 0 : -1;
#endif #endif
} }