|
From: Malcolm T. <ma...@co...> - 2003-06-27 12:18:47
|
Hi Narayana, On Fri, 2003-06-27 at 21:58, Narayana Pattipati wrote: > Hi All, > > Please have a look at the attached patch which fixes a SEGV in > scrollkeeper-update. > > Problem Description: > > When scrollkeeper-rebuilddb is done on a system which has many locales, > scrollkeeper-update is crashing at the following place in scrollkeeper > code. > > scrollkeeper/libs/install.c:create_toc_tree() > snprintf(command, 1024, "scrollkeeper-get-toc-from-docpath %s", > docpath); > config_fid = popen(command, "r"); > fscanf(config_fid, "%s", tocpath); > if (pclose(config_fid)) > return NULL; > > The file descriptor returned from popen() is NULL and when it is passed > to fscanf(), the application is crashing. > > Reason for popen() failure is that the process is running out of file > descriptors. > > In scrollkeeper/libs/install.c:get_unique_doc_id() function, a file > descriptor is opened to register each OMF file with SK database. Once > the file descriptor is used, it is not closed. If there are more than > 256 files to be registered already, popen() fails for consequent files. > > Solution: > Close the file descriptors after using them. I have closed file > descriptors opened in few other places also. > > Note: Max files opened varies across platforms. In Solaris, defalt value > is 256. Thanks for working out what was going wrong here and supplying the patch. It looks pretty good to me and I will put it in CVS. Cheers, Malcolm |