hash_notify_init is never called

Jeremy Allison jeremy at valinux.com
Fri Mar 30 16:12:30 GMT 2001

On Fri, Mar 30, 2001 at 04:22:08PM +0200, Juergen Hasch wrote:
> Hello,
> in smbd/notify.c ( samba_2.2.0_alpha3 and head ) there seems to be an
> invalid test for cnotify:
> BOOL init_change_notify(void)
> {
>         cnotify = kernel_notify_init();
> #endif
>         if (!cnotify) cnotify = hash_notify_init();
>         if (!cnotify) {
>                 DEBUG(0,("Failed to init change notify system\n"));
>                 return False;
>         }
>         return True;
> }
> Because cnotify is not zeroed, hash_notify_init will never be called if
> the kernel change notification is not compiled in.
> After adding 
>  cnotify==NULL;
> at the start of the function I get the hash notification running.

But this would cause hash_notify_init to be called every time
init_change_notify() is called. Now I know it should only
be called once, but cnotify is declared at the top of the file
as a static pointer. The compiler will put this in the BSS segment
which is zeroed on load.

Your fix is not correct here, but I'm interested to see why
cnotify is not zero for you when being called. Can you compile
using debug and walk into the function with a debugger ?


Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.

More information about the samba-technical mailing list