[Fedora-directory-commits] adminserver/lib/libadmin install.c, 1.6, 1.7 util.c, 1.10, 1.11

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Jul 14 20:34:45 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/adminserver/lib/libadmin
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6632/adminserver/lib/libadmin

Modified Files:
	install.c util.c 
Log Message:
removing dead code


Index: install.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libadmin/install.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- install.c	9 May 2007 00:26:37 -0000	1.6
+++ install.c	14 Jul 2008 20:34:43 -0000	1.7
@@ -51,7 +51,7 @@
 {
     int sd;
     struct sockaddr_in sa_server;
-    int one = 1, ret;
+    int ret;
 
 #ifdef XP_WIN32
     WSADATA wsd;


Index: util.c
===================================================================
RCS file: /cvs/dirsec/adminserver/lib/libadmin/util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- util.c	31 Oct 2007 05:30:54 -0000	1.10
+++ util.c	14 Jul 2008 20:34:43 -0000	1.11
@@ -186,130 +186,6 @@
     return ans;
 }
 
-int ADM_mkdir_p(char *dir, int mode)
-{
-   char path[PATH_MAX];
-   struct stat fi;
-   char *slash = NULL;
-    
-   if (dir)
-      PL_strncpyz (path, dir, sizeof(path));
-   else
-      return 0;
-
-   if (slash = strchr(path, FILE_PATHSEP)) 
-      slash++; /* go past root */
-   else
-      return 0;
-
-   while (slash && *slash) {
-      slash = strchr(slash, FILE_PATHSEP);
-      if (slash) *slash = '\0'; /* check path till here */
-                
-      if (stat(path, &fi) == -1) {
-#ifdef XP_UNIX
-         if (mkdir(path, mode) == -1)
-#else  /* XP_WIN32 */
-         if (!CreateDirectory(path, NULL))
-#endif
-            return 0;
-      }
-
-      if (slash) {
-         *slash = FILE_PATHSEP; /* restore path */
-         slash++; /* check remaining path */
-      }
-   }
-   return 1;
-}
-
-int ADM_copy_directory(char *src_dir, char *dest_dir)
-{
-   SYS_DIR ds;
-   SYS_DIRENT *d;
-   struct stat fi;
-   char src_file[PATH_MAX], dest_file[PATH_MAX], fullname[PATH_MAX];
-
-   if (!(ds = dir_open(src_dir))) 
-      report_error(FILE_ERROR, "Can't read directory", src_dir);
-
-   while (d = dir_read(ds)) {
-      if (d->d_name[0] != '.') {
-         PR_snprintf(fullname, sizeof(fullname), "%s/%s", src_dir, d->d_name);
-         if (system_stat(fullname, &fi) == -1)
-            continue;
-
-         PR_snprintf(src_file, sizeof(src_file), "%s%c%s", src_dir,  FILE_PATHSEP, d->d_name);
-         PR_snprintf(dest_file, sizeof(dest_file), "%s%c%s", dest_dir, FILE_PATHSEP, d->d_name);
-         if (S_ISDIR(fi.st_mode)) {
-            char *sub_src_dir = STRDUP(src_file);
-            char *sub_dest_dir = STRDUP(dest_file);
-            if (!ADM_mkdir_p(sub_dest_dir, 0755)) {
-               report_error(FILE_ERROR, "Cannot create directory",
-                                                           sub_dest_dir);
-               return 0;
-            }
-            if (!ADM_copy_directory(sub_src_dir, sub_dest_dir))
-               return 0;
-            FREE(sub_src_dir);
-            FREE(sub_dest_dir);
-         }
-         else 
-            cp_file(src_file, dest_file, 0644);
-      }
-   }
-   dir_close(ds);
-   return(1);
-}
-
-void ADM_remove_directory(char *path)
-{
-    struct stat finfo;
-    char **dirlisting;
-    register int x=0;
-    int stat_good = 0;
-    char *fullpath = NULL;
-
-#ifdef XP_UNIX
-    stat_good = (lstat(path, &finfo) == -1 ? 0 : 1);
-#else /* XP_WIN32 */
-    stat_good = (stat(path, &finfo) == -1 ? 0 : 1);
-#endif
- 
-    if(!stat_good) return;
-
-    if(S_ISDIR(finfo.st_mode))  {
-        dirlisting = list_directory(path,1);
-        if(!dirlisting) return;
-
-        for(x=0; dirlisting[x]; x++)  {
-            fullpath = (char *) MALLOC(strlen(path) + 
-                                       strlen(dirlisting[x]) + 4);
-            sprintf(fullpath, "%s%c%s", path, FILE_PATHSEP, dirlisting[x]);
-#ifdef XP_UNIX
-            stat_good = (lstat(fullpath, &finfo) == -1 ? 0 : 1);
-#else /* XP_WIN32 */
-            stat_good = (stat(fullpath, &finfo) == -1 ? 0 : 1);
-#endif
-            if(!stat_good) continue;
-            if(S_ISDIR(finfo.st_mode))  {
-                ADM_remove_directory(fullpath);
-            }  else  {
-                unlink(fullpath);
-            }
-            FREE(fullpath);
-        }
-#ifdef XP_UNIX
-        rmdir(path);
-#else /* XP_WIN32 */
-        RemoveDirectory(path);
-#endif
-    }  else  {
-        delete_file(path);
-    }
-    return;
-}
-
 /* return: mtime(f1) < mtime(f2) ? */
 int mtime_is_earlier(char *file1, char *file2)
 {
@@ -1382,7 +1258,7 @@
                 ptr = PL_strdup(ptr);
             }
             /* copy now points at the parent, ptr at the child */
-            if (pdir = PR_OpenDir(copy)) {
+            if ((pdir = PR_OpenDir(copy))) {
                 for(pent = PR_ReadDir(pdir, PR_SKIP_BOTH); pent && !ret;
                     pent = PR_ReadDir(pdir, PR_SKIP_BOTH)) {
                     ret = !strcmp(pent->name, ptr);
@@ -1393,7 +1269,7 @@
                 ret = 0;
                 /* we've verified that name is a valid directory - see if
                    the given filename exists in that directory */
-                if (pdir = PR_OpenDir(name)) {
+                if ((pdir = PR_OpenDir(name))) {
                     for(pent = PR_ReadDir(pdir, PR_SKIP_BOTH); pent && !ret;
                         pent = PR_ReadDir(pdir, PR_SKIP_BOTH)) {
                         if (childlen > 0) {




More information about the Fedora-directory-commits mailing list