Package: nfdump
Version: 1.5.7-2
Severity: normal

Hi,

I noticed nfcapd did not restart after a config change. After a long
search the reason was found at bookkeeper.c:160:

    158         shm_id = shmget(shm_key, sizeof(bookkeeper_t), 0600);
    159
    160         if ( shm_id > 0 ) {
    161                 // the segment already exists. Either a running process 
is active
    162                 // or an unclean shutdown happened

As described in the shmget manpage, a value of -1 indicates an error
situation, therefore 0 should be treated as a valid id.  This actually
happened on system but don't ask me how I did this:

# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x082e0009 0          root      600        64         0      
(...)

The current code not only prevented nfcapd from running but also gave a
completely misleading error message later since errno was not changed by
the successful (from glibc's point of view) shmget call.

The easy fix
    160         if ( shm_id >= 0 ) {
works for me.

    Christoph



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to