bug-cfengine
[Top][All Lists]
Advanced

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

Disable Directory Error Bug


From: Robert Shaw
Subject: Disable Directory Error Bug
Date: Mon, 16 Apr 2001 11:01:28 -0700

Mark,

Here's an annoying bug that I just fixed. When you have a disable action
with a type=link or type=file argument, it complains if the item is a
directory and issues an annoying error message/warning rather than
properly checking the type= option and saying it's ok.

Attached is the patch to fix this bug, as well as the test-case that
shows it.

Please add to the next release.

Thanks,
-Robert
control:
        domain = ( mydomain.com )

        actionsequence = ( 
                disable
        )

disable:

        /usr/local               type=link
        /usr/sepp                type=link

Index: src/do.c
===================================================================
RCS file: /home/cadphx/cvsroot/gnu/cfengine/src/do.c,v
retrieving revision 1.4
diff -u -r1.4 do.c
--- src/do.c    2001/04/16 17:36:07     1.4
+++ src/do.c    2001/04/16 17:56:42
@@ -1439,16 +1439,23 @@
       continue;
       }
 
-   Verbose("Disable checking %s\n",workname);
-
    if (S_ISDIR(statbuf.st_mode))
       {
-      sprintf(OUTPUT,"Warning %s is a directory.\n",workname);
-      CfLog(cferror,OUTPUT,"");
-      CfLog(cferror,"I refuse to rename/delete a directory!\n\n","");
+      if ((strcmp(dp->type,"file") != 0) && (strcmp(dp->type,"link") != 0))
+         {
+         sprintf(OUTPUT,"Warning %s is a directory.\n",workname);
+         CfLog(cferror,OUTPUT,"");
+         CfLog(cferror,"I refuse to rename/delete a directory!\n\n","");
+         }
+      else
+         {
+         Verbose("Filetype %s, %s is not there - ok\n",dp->type,workname);
+         }
       ResetOutputRoute('d','d');
       continue;
       }
+
+   Verbose("Disable checking %s\n",workname);
 
    if (S_ISLNK(statbuf.st_mode))
       {

reply via email to

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