Changeset 2332 for zzuf


Ignore:
Timestamp:
May 18, 2008, 11:45:48 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Make sure the fgets_unlocked() reimplementation uses fgetc_unlocked(), not fgetc().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/lib-stream.c

    r2331 r2332  
    370370
    371371#if defined HAVE___SREFILL /* Don't fuzz or seek if we have __srefill() */
    372 #   define FGETS_FUZZ \
     372#   define FGETS_FUZZ(fn, fn2) \
    373373        _zz_lock(fd); \
    374         ret = ORIG(fgets)(s, size, stream); \
     374        ret = ORIG(fn)(s, size, stream); \
    375375        _zz_unlock(fd);
    376376#else
    377 #   define FGETS_FUZZ \
     377#   define FGETS_FUZZ(fn, fn2) \
    378378        if(size <= 0) \
    379379            ret = NULL; \
     
    387387                int ch; \
    388388                _zz_lock(fd); \
    389                 ch = ORIG(fgetc)(stream); \
     389                ch = ORIG(fn2)(stream); \
    390390                _zz_unlock(fd); \
    391391                if(ch == EOF) \
     
    408408#endif
    409409
    410 #define FGETS(fn) \
     410#define FGETS(fn, fn2) \
    411411    do \
    412412    { \
     
    414414        ret = s; \
    415415        LOADSYM(fn); \
    416         LOADSYM(fgetc); \
     416        LOADSYM(fn2); \
    417417        fd = fileno(stream); \
    418418        if(!_zz_ready || !_zz_iswatched(fd) || !_zz_isactive(fd)) \
    419419            return ORIG(fn)(s, size, stream); \
    420         FGETS_FUZZ \
     420        FGETS_FUZZ(fn, fn2) \
    421421        debug("%s(%p, %i, [%i]) = %p", __func__, s, size, fd, ret); \
    422422    } while(0)
     
    424424char *NEW(fgets)(char *s, int size, FILE *stream)
    425425{
    426     char *ret; FGETS(fgets); return ret;
     426    char *ret; FGETS(fgets, fgetc); return ret;
    427427}
    428428
     
    430430char *NEW(fgets_unlocked)(char *s, int size, FILE *stream)
    431431{
    432     char *ret; FGETS(fgets_unlocked); return ret;
     432    char *ret; FGETS(fgets_unlocked, fgetc_unlocked); return ret;
    433433}
    434434#endif
Note: See TracChangeset for help on using the changeset viewer.