Author: mladen.turk(a)jboss.com
Date: 2007-09-25 01:55:25 -0400 (Tue, 25 Sep 2007)
New Revision: 1043
Modified:
trunk/sight/native/os/linux/scm.c
Log:
Cleanup resources on error
Modified: trunk/sight/native/os/linux/scm.c
===================================================================
--- trunk/sight/native/os/linux/scm.c 2007-09-24 07:39:31 UTC (rev 1042)
+++ trunk/sight/native/os/linux/scm.c 2007-09-25 05:55:25 UTC (rev 1043)
@@ -96,13 +96,23 @@
}
no->native = si;
while (scm_paths[i].flavor) {
+ char sname[PATH_MAX];
+ struct stat sb;
if ((sd = opendir(scm_paths[i].idpath))) {
+ sprintf(sname, scm_paths[i].rlpath, scm_paths[i].rlevel);
+ /* Check default run level path */
+ if (stat(sname, &sb) < 0) {
+ closedir(sd);
+ sd = NULL;
+ continue;
+ }
si->flavor = scm_paths[i].flavor;
si->idpath = scm_paths[i].idpath;
si->rlpath = scm_paths[i].rlpath;
si->what = scm_paths[i].rlevel;
if (!(si->services = sight_arr_new(16))) {
apr_status_t rv = apr_get_os_error();
+ closedir(sd);
scm_cleanup(0, no);
return rv;
}
Show replies by date