|
From: Narayana P. <nar...@wi...> - 2003-06-27 11:48:01
|
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. Please let me know your comments on the patch. Thanks, Narayana |