[OPEN-ILS-DEV] PATCH: osrf_system.c (avoiding "config file is NULL")

Scott McKellar mck9 at swbell.net
Sun Jun 3 10:30:08 EDT 2007


This is another patch addressing the "config pointer is NULL" issue.

As noted earlier, if the config pointer is null, it's because 
osrf_settings_retrieve() failed to populate it, or was never called.
If it fails, it returns -1 instead of zero.

So far as I can tell, the only place osrf_settings_retrieve() is
called is in osrfSystemBootstrap() (in osrf_system.c), which doesn't
currently check the return code.  It just assumes success, and then
calls osrfSystemBootstrap() willy-nilly.

Accordingly, this patch adds a check of that return code.  If the
return code is non-zero, we will log a message and return -1
immediately, without trying to bootstrap further.

I also expanded an existing message to identify the host and
configuration file.  I don't know if this additional information
will be useful, but I'd rather provide too much information than
too little.

--------------

So far as I can tell, the only application affected by this patch
will be opensrf.  It calls osrfSystemBootstrap() but does not check
the return code -- possibly because, until recently, a successful
call would enter an endless loop that could be interrupted only by
killing the process.

Now the loop ends when all child processes have terminated, or when
wait() encounters an error.  osrfSystemBootstrap() returns zero in 
either case.  It returns non-zero only if it never gets to the point
of spawning child processes in the first place.

I wonder if opensrf should now check the return code, and issue a 
message if it's non-zero.

Scott McKellar
http://home.swbell.net/mck9/aargh/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_system_c_6.patch
Type: text/x-patch
Size: 1311 bytes
Desc: 3640273627-osrf_system_c_6.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070603/9c610bb4/osrf_system_c_6-0001.bin


More information about the Open-ils-dev mailing list