diff --git a/src/lib-stream.c b/src/lib-stream.c index eb46f1b..faeb4d4 100644 --- a/src/lib-stream.c +++ b/src/lib-stream.c @@ -23,8 +23,9 @@ /* Needed for getc_unlocked() on OpenSolaris */ #define __EXTENSIONS__ -#if defined HAVE___SREFILL || defined HAVE___FILBUF -# define HAVE_REFILL_STDIO +/* Define if stdio operations use *only* the refill mechanism */ +#if defined HAVE___SREFILL +# define REFILL_ONLY_STDIO #endif #if defined HAVE_STDINT_H @@ -36,7 +37,7 @@ #include #include -#if defined HAVE_REFILL_STDIO && defined HAVE_UNISTD_H +#if defined HAVE_UNISTD_H # include /* Needed for __srefill’s lseek() call */ #endif @@ -144,7 +145,7 @@ int (*ORIG(__filbuf)) (FILE *fp); #endif /* Our function wrappers */ -#if defined HAVE_REFILL_STDIO /* Fuzz fp if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Fuzz fp if we have __srefill() */ # define FOPEN_FUZZ() \ _zz_fuzz(fd, ret->FILE_PTR, ret->FILE_CNT) #else @@ -231,7 +232,7 @@ FILE *NEW(__freopen64)(const char *path, const char *mode, FILE *stream) } #endif -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ # define FSEEK_FUZZ(fn2) #else # define FSEEK_FUZZ(fn2) \ @@ -343,14 +344,14 @@ void NEW(rewind)(FILE *stream) _zz_unlock(fd); debug("%s([%i])", __func__, fd); -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ #else /* FIXME: check what happens when rewind()ing a pipe */ _zz_setpos(fd, 0); #endif } -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ # define FREAD_FUZZ() \ do \ { \ @@ -420,7 +421,7 @@ size_t NEW(fread_unlocked)(void *ptr, size_t size, size_t nmemb, FILE *stream) } #endif -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ # define FGETC_FUZZ #else # define FGETC_FUZZ \ @@ -498,7 +499,7 @@ int NEW(fgetc_unlocked)(FILE *stream) } #endif -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ # define FGETS_FUZZ(fn, fn2) \ _zz_lock(fd); \ ret = ORIG(fn)(s, size, stream); \ @@ -582,7 +583,7 @@ int NEW(ungetc)(int c, FILE *stream) fuzz->uflag = 1; fuzz->upos = _zz_getpos(fd) - 1; fuzz->uchar = c; -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ #else _zz_addpos(fd, -1); #endif @@ -695,7 +696,7 @@ ssize_t NEW(__getdelim)(char **lineptr, size_t *n, int delim, FILE *stream) char *NEW(fgetln)(FILE *stream, size_t *len) { char *ret; -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ #else struct fuzz *fuzz; size_t i, size; @@ -708,7 +709,7 @@ char *NEW(fgetln)(FILE *stream, size_t *len) if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd)) return ORIG(fgetln)(stream, len); -#if defined HAVE_REFILL_STDIO /* Don't fuzz or seek if we have __srefill() */ +#if defined REFILL_ONLY_STDIO /* Don't fuzz or seek if we have __srefill() */ _zz_lock(fd); ret = ORIG(fgetln)(stream, len); _zz_unlock(fd);