bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Segfault doing copy recurse with purge


From: Adrian Phillips
Subject: [PATCH] Segfault doing copy recurse with purge
Date: 15 May 2002 13:30:10 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

While doing a copy action with purge on I was getting segfaults;
noticed that exclusion was being used without being set. I'm not
hundred percent certain of this patch, it seems to work, ie. no
segfaults but I'm not sure which exclude to use the copy exclude or
the global exclude :-

Sincerely,

Adrian Phillips

diff -urN cfengine-2.0.0/src/image.c cfengine-2.0.0-hacked/src/image.c
--- cfengine-2.0.0/src/image.c  Thu Feb 14 07:46:46 2002
+++ cfengine-2.0.0-hacked/src/image.c   Wed May 15 06:20:37 2002
@@ -198,7 +198,7 @@
 
 if (ip->purge == 'y')
    {
-   PurgeFiles(namecache,to);
+   PurgeFiles(namecache,to,ip->exclusions);
    DeleteItemList(namecache);
    }
  
@@ -478,10 +478,11 @@
 
 /*********************************************************************/
 
-void PurgeFiles(filelist,directory)
+void PurgeFiles(filelist,directory,exclusions)
 
 struct Item *filelist;
 char *directory;
+struct Item *exclusions;
 
 { DIR *dirh;
   struct stat statbuf; 
@@ -551,6 +552,7 @@
             tp.tidylist = &tpat;
             tp.next = NULL;
             tp.path = filename;
+                tp.exclusions = exclusions;
             
             tpat.recurse = INFINITERECURSE;
             tpat.age = 0;
@@ -1312,7 +1314,7 @@
       if (S_ISDIR(s.st_mode))
         {
         backupisdir = true;
-        PurgeFiles(NULL,backup);
+        PurgeFiles(NULL,backup,NULL);
         rmdir(backup);
         }
 
@@ -1332,7 +1334,7 @@
       {
       if (S_ISDIR(s.st_mode))
         {
-        PurgeFiles(NULL,dest);
+        PurgeFiles(NULL,dest,NULL);
         rmdir(dest);
         }
       }
diff -urN cfengine-2.0.0/src/prototypes.h cfengine-2.0.0-hacked/src/prototypes.h
--- cfengine-2.0.0/src/prototypes.h     Wed May 15 06:21:22 2002
+++ cfengine-2.0.0-hacked/src/prototypes.h      Wed May 15 05:52:03 2002
@@ -351,7 +351,7 @@
 void RecursiveImage ARGLIST((struct Image *ip, char *from, char *to, int 
maxrecurse));
 void CheckHomeImages ARGLIST((struct Image *ip));
 void CheckImage ARGLIST((char *source, char *destination, struct Image *ip));
-void PurgeFiles ARGLIST((struct Item *filelist, char *directory));
+void PurgeFiles ARGLIST((struct Item *filelist, char *directory, struct Item 
*exclusions));
 void ImageCopy ARGLIST((char *sourcefile, char *destfile, struct stat 
sourcestatbuf, struct Image *ip));
 int cfstat ARGLIST((char *file, struct stat *buf, struct Image *ip));
 int cflstat ARGLIST((char *file, struct stat *buf, struct Image *ip));


-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]