bug-cfengine
[Top][All Lists]
Advanced

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

[patch 2.1.0p1] RecursiveImage(): don't use result of failed stat()


From: Sergio . Gelato
Subject: [patch 2.1.0p1] RecursiveImage(): don't use result of failed stat()
Date: Sat, 13 Dec 2003 18:47:27 +0100
User-agent: Mutt/1.3.28i

The following patch against cfengine 2.1.0p1 corrects a bug whereby an
undefined value (of deststatbuf) would be passed to CheckCopiedFile()
under certain circumstances, resulting in unpredictable directory
permissions.

--- orig/src/image.c
+++ mod/src/image.c
@@ -214,6 +214,12 @@
       if (stat(newto,&deststatbuf) == -1)
         {
         mkdir(newto,statbuf.st_mode);
+        if (stat(newto,&deststatbuf) == -1)
+           {
+           snprintf(OUTPUT,bufsize*2,"Can't stat %s\n",newto);
+           CfLog(cferror,OUTPUT,"stat");
+           continue;
+           }
         }
 
       
CheckCopiedFile(newto,ip->plus,ip->minus,fixall,ip->uid,ip->gid,&deststatbuf,&statbuf,NULL,ip->acl_aliases);






reply via email to

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