OSSP CVS Repository

ossp - Check-in [3488]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3488
Date: 2003-Jul-02 17:30:20 (local)
2003-Jul-02 15:30:20 (UTC)
User:ms
Branch:
Comment: Implement location and temporary directory checks.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc_config.c      1.36 -> 1.37     27 inserted, 11 deleted

ossp-pkg/rc/rc_config.c 1.36 -> 1.37

--- rc_config.c  2003/06/26 18:45:14     1.36
+++ rc_config.c  2003/07/02 15:30:20     1.37
@@ -284,7 +284,7 @@
 rc_return_t configDefaults(void)
 {
     ex_t Except;
-    DIR *pTmpdir = NULL; /* For detecting our temp dir with opendir(3) */
+    DIR *pDir = NULL; /* For detecting our temp dir with opendir(3) */
 
     try { /* Test members for empty attributes */
         if (!configGetval(RC_EVL_VAL) && !configGetval(RC_EXC_VAL) \
@@ -296,14 +296,16 @@
         if (!configGetval(RC_RAW_VAL))
         if (!configGetval(RC_VRB_VAL))*/
 
-/*
-        if (!configGetval(RC_LOC_VAL)) {
-            If exists '/etc/rc.d'
-                clioptSetval(RC_LOC_VAL, "/etc/rc.d/rc.");
-                FIXME: !This 'rc.' reading logic must still be implemented!
-            Else
-                RC_NOP;
+        if (configGetval(RC_LOC_VAL)) {
+            if ((pDir = opendir(configGetval(RC_LOC_VAL))) == NULL)
+                return(RC_THROW(RC_ERR_LOC));   /* Failure, dir doesn't exist */
+            else
+                closedir(pDir);                 /* Success, directory exists */
         }
+        else
+            clioptSetval(RC_LOC_VAL, "./");
+
+/*
         if (!configGetval(RC_CNF_VAL)) {
             If exists '/etc/rcconf'
                 clioptSetval(RC_CNF_VAL, "/etc/rcconf");
@@ -320,11 +322,25 @@
 
 /*        if (!configGetval(RC_QRY_VAL))*/
 
+        if (configGetval(RC_TMP_VAL)) {
+            if ((pDir = opendir(configGetval(RC_TMP_VAL))) == NULL)
+                return(RC_THROW(RC_ERR_TMP));   /* Failure, tmp doesn't exist */
+            else
+                closedir(pDir);                 /* Success, tmp dir exists */
+        }
+        else {                                      /* User didn't set tmp so */
+            clioptSetval(RC_TMP_VAL, RC_DEF_TMP);   /* set it for them here   */
+            if ((pDir = opendir(RC_DEF_TMP)) == NULL)    /* Try using default */
+                return(RC_THROW(RC_ERR_TMP));   /* Failure, default not there */
+            else
+                closedir(pDir);
+        }
+
         if (!configGetval(RC_TMP_VAL)) {
-            pTmpdir = opendir(RC_DEF_TMP);
-            if (pTmpdir)
+            pDir = opendir(RC_DEF_TMP);
+            if (pDir)
                 clioptSetval(RC_TMP_VAL, RC_DEF_TMP);
-            closedir(pTmpdir);
+            closedir(pDir);
         }
 
 /*        if (!configGetval(RC_OWN_VAL))

CVSTrac 2.0.1