OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_anal.c versions 1.7 and 1.8
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_anal.c 1.7 -> 1.8

--- rc_anal.c    2002/06/28 14:20:23     1.7
+++ rc_anal.c    2002/06/28 17:43:23     1.8
@@ -55,20 +55,27 @@
 ************************************************/
 rc_return_t analRcs(rc_anal_t **ppInst, const char *kszName)
 {
+    ex_t Except;
+
     assert(!(*ppInst)->m_szRcs); /* Rcs should be NULL until we set them */
 
-    if (!kszName) {
-        (*ppInst)->m_szRcs = NULL;
-/*        RC_THROW(RC_WRN_NUL);*/
-    }
+    if (!kszName)
+        return(RC_THROW(RC_ERR_RCF));
     else { /* Only enter block with valid string, strdup can't handle NULL */
         (*ppInst)->m_szRcs = malloc(sizeof(char **));
         if (strcmp(kszName, RC_GLOB_WILD)) {
-            *(*ppInst)->m_szRcs = strdup("rc.");
+            *(*ppInst)->m_szRcs = strdup("rc."); /* FIXME: Remove hardcoded */
             strcat(*(*ppInst)->m_szRcs, kszName);
         }
-        else /* Wildcard rcfile indicates we must glob the locs directories */
-            analGloblocs(ppInst);
+        else { /* Wildcard rcfile indicates we must glob the locs directories */
+            try {
+                analGloblocs(ppInst);
+            }
+            catch(Except) {
+fprintf(stderr, "Placeholder until ex_ looping bug is fixed.\n");
+/*                rethrow;*/ /* FIXME: Ralf! Looping problem with ex_ hier! */
+            }
+        }
     }
 
     return(RC_THROW(RC_OK));
@@ -117,10 +124,16 @@
     if (!kszPathexpr) {
         (*ppInst)->m_szLocs = NULL;
         (*ppInst)->m_szLocs = strdup("./"); /* FIXME: Relocate default val */
-/*        RC_THROW(RC_WRN_NUL);*/
+/*        RC_THROW(RC_WRN_NUL);*/ /* FIXME: ex_ Illegal instruction - core dumped */
     }
     else { /* Only enter block with valid string, strdup can't handle NULL */
-        (*ppInst)->m_szLocs = strdup(kszPathexpr);
+        if (*(kszPathexpr + strlen(kszPathexpr)) != '/') {
+            (*ppInst)->m_szLocs = malloc(strlen(kszPathexpr) + 2 * sizeof(char));
+            strcpy((*ppInst)->m_szLocs, kszPathexpr);
+            strcat((*ppInst)->m_szLocs, "/");
+        }
+        else
+            (*ppInst)->m_szLocs = strdup(kszPathexpr);
     }
 
     return(RC_THROW(RC_OK));
@@ -179,6 +192,10 @@
     pppFiles = malloc(sizeof(struct dirent));
     nCount = scandir((*ppInst)->m_szLocs, pppFiles, analFileselect, alphasort);
 
+    /* Check out the health of this directory */
+    if (nCount == -1)
+        return(RC_THROW(RC_ERR_DIR));
+
     /* Loop through file index setting Rf file names according to dirent */
     for (nIter = 0; nIter < nCount; ++nIter)
         (*ppInst)->m_szRcs[nIter] = strdup((*pppFiles)[nIter]->d_name);
@@ -209,10 +226,8 @@
         analFuncs(&pInst, configGetval(RC_FNC_VAL));
         analSecs (&pInst, configGetsecs());
     }
-    ex_catch(Except) {
-TRACE("Parsing broke");
-/*        rethrow;*/
-    }
+    ex_catch(Except)
+        rethrow;
 
     return(RC_THROW(RC_OK));
 }

CVSTrac 2.0.1