ec_resolv.c (ettercap-0.8.3) | : | ec_resolv.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 362 | skipping to change at line 362 | |||
u_int32 h; | u_int32 h; | |||
pthread_t pid; | pthread_t pid; | |||
char tmp[MAX_ASCII_ADDR_LEN]; | char tmp[MAX_ASCII_ADDR_LEN]; | |||
/* | /* | |||
* make sure this function is not called by the main thread. | * make sure this function is not called by the main thread. | |||
* this is important because parallel writing of the cache | * this is important because parallel writing of the cache | |||
* can lead to segmentation faults due to race conditions | * can lead to segmentation faults due to race conditions | |||
*/ | */ | |||
pid = pthread_self(); | pid = pthread_self(); | |||
if (pthread_equal(pid, EC_PTHREAD_NULL)) { | if (pthread_equal(pid, ec_thread_getpid(NULL))) { | |||
DEBUG_MSG("resolv_cache_insert: not called by a thread - aborting"); | DEBUG_MSG("resolv_cache_insert: not called by a thread - aborting"); | |||
return; | return; | |||
} | } | |||
/* calculate the hash */ | /* calculate the hash */ | |||
h = fnv_32(ip->addr, ntohs(ip->addr_len)) & TABMASK; | h = fnv_32(ip->addr, ntohs(ip->addr_len)) & TABMASK; | |||
/* | /* | |||
* search if it is already in the cache. | * search if it is already in the cache. | |||
* this will pervent passive insertion to overwrite | * this will pervent passive insertion to overwrite | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |