]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Fix a couple of compiler warnings in wx-console
authorKern Sibbald <kern@sibbald.com>
Wed, 20 Dec 2006 13:59:50 +0000 (13:59 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 20 Dec 2006 13:59:50 +0000 (13:59 +0000)
kes  Apply the immutable patch for FreeBSD hardlinked files supplied
     by Olivier Lehmann.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3822 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ChangeLog
bacula/src/findlib/create_file.c
bacula/src/wx-console/wxbconfigpanel.cpp
bacula/technotes-1.39

index 9ee1341f9ad3ca4c1ad0d60ac097345b983e5054..fcc4b88c51e15863535e651b69caa3e2e848f120 100644 (file)
@@ -4,6 +4,9 @@ General:
 
 Version 1.39.32 released: 
 20Dec06
+kes  Fix a couple of compiler warnings in wx-console
+kes  Apply the immutable patch for FreeBSD hardlinked files supplied
+     by Olivier Lehmann.
 kes  Add Volume name to Forward spacing message.
 kes  Update migration job start time (so it is not zero) to prevent
      immediate recycling of the job.  This *should* fix bug #733.
index 8b20ff45598f47b03856dd7fffb89c5599a303f8..3d08fdcc8447259478da786c5be72d11128b5b09 100644 (file)
@@ -289,9 +289,46 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
          Dmsg2(130, "Hard link %s => %s\n", attr->ofname, attr->olname);
          if (link(attr->olname, attr->ofname) != 0) {
             berrno be;
+#ifdef HAVE_CHFLAGS
+            struct stat s;
+
+        /*
+            * If using BSD user flags, maybe has a file flag
+            * preventing this. So attempt to disable, retry link,
+            * and reset flags.
+            * Note that BSD securelevel may prevent disabling flag.
+       */
+
+            if (stat(attr->olname, &s) == 0 && s.st_flags != 0) {
+               if (chflags(attr->olname, 0) == 0) {
+                  if (link(attr->olname, attr->ofname) != 0) {
+                     /* restore original file flags even when linking failed */
+                     if (chflags(attr->olname, s.st_flags) < 0) {
+                        Qmsg2(jcr, M_ERROR, 0, _("Could not restore file flags for file %s: ERR=%s\n"),
+                              attr->olname, be.strerror());
+                     }
+#endif /* HAVE_CHFLAGS */
             Qmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s: ERR=%s\n"),
                   attr->ofname, attr->olname, be.strerror());
             return CF_ERROR;
+#ifdef HAVE_CHFLAGS
+                  }
+                  /* finally restore original file flags */
+                  if (chflags(attr->olname, s.st_flags) < 0) {
+                     Qmsg2(jcr, M_ERROR, 0, _("Could not restore file flags for file %s: ERR=%s\n"),
+                            attr->olname, be.strerror());
+                  }
+               } else {
+                 Qmsg2(jcr, M_ERROR, 0, _("Could not reset file flags for file %s: ERR=%s\n"),
+                       attr->olname, be.strerror());
+               }
+            } else {
+              Qmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s: ERR=%s\n"),
+                    attr->ofname, attr->olname, be.strerror());
+              return CF_ERROR;
+            }
+#endif /* HAVE_CHFLAGS */
+
          }
          return CF_CREATED;
 #endif
index c6167ae3bbef7f5a1b6d771445e8b8deef403844..738112773f66c083d1fb4d61c74eca1f6e96df7c 100644 (file)
@@ -137,13 +137,13 @@ void wxbConfigParam::SetValue(wxString str) {
    case choice:
       if (choicectrl) {
          int k;
-         for (k = 0; k < choicectrl->GetCount(); k++) {
+         for (k = 0; k < (int)choicectrl->GetCount(); k++) {
             if (str == choicectrl->GetString(k)) {
                choicectrl->SetSelection(k);
                break;
             }
          }
-         if (k == choicectrl->GetCount()) { // Should never happen
+         if (k == (int)choicectrl->GetCount()) { // Should never happen
             choicectrl->Append(str);
             choicectrl->SetSelection(k);
          }
index 7feb40bfe8464f1247889ced91f0bd5e5c1a6a65..0c5bc046ee4ace7c9fe15c1b103939ce0164ec7a 100644 (file)
@@ -3,6 +3,9 @@
 General:
 Version 1.39.32 released: 
 20Dec06
+kes  Fix a couple of compiler warnings in wx-console
+kes  Apply the immutable patch for FreeBSD hardlinked files supplied
+     by Olivier Lehmann.
 kes  Add Volume name to Forward spacing message.
 kes  Update migration job start time (so it is not zero) to prevent
      immediate recycling of the job.  This *should* fix bug #733.