Ignore:
Timestamp:
Dec 20, 2009, 1:24:56 PM (11 years ago)
Author:
Sam Hocevar
Message:

Try to call _zz_init() as soon as possible. Otherwise, preloaded libraries
might be confused about half the calls actually working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/libzzuf/libzzuf.c

    r4112 r4152  
    4949#include "fuzz.h"
    5050
    51 /* Library initialisation shit */
    52 #if defined __GNUC__
    53 void _zz_init(void) __attribute__((constructor));
    54 void _zz_fini(void) __attribute__((destructor));
    55 #elif defined HAVE_PRAGMA_INIT
    56 #   pragma INIT "_zz_init"
    57 #   pragma FINI "_zz_fini"
    58 #endif
    59 
    6051#if defined HAVE_WINDOWS_H
    6152BOOL WINAPI DllMain(HINSTANCE, DWORD, PVOID);
     
    115106void _zz_init(void)
    116107{
     108    static int initializing = 0;
    117109    char *tmp, *tmp2;
     110
     111    /* Make sure we don't get initialised more than once */
     112    if (initializing++)
     113        return;
    118114
    119115    tmp = getenv("ZZUF_DEBUG");
     
    209205void _zz_fini(void)
    210206{
     207    if (!_zz_ready)
     208        return;
     209
     210    debug("libzzuf finishing for PID %li", (long int)getpid());
     211
    211212    _zz_fd_fini();
    212213    _zz_network_fini();
     214
     215    _zz_ready = 0;
    213216}
    214217
Note: See TracChangeset for help on using the changeset viewer.