]> git.sur5r.net Git - bacula/bacula/commitdiff
Work on Dir seg fault reported by Frank Sweetser
authorKern Sibbald <kern@sibbald.com>
Sun, 23 Dec 2007 12:14:54 +0000 (12:14 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 23 Dec 2007 12:14:54 +0000 (12:14 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6108 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/ua_restore.c
bacula/src/lib/bsnprintf.c
bacula/technotes-2.1

index 9b0dc9090ddd01405d2e54a088e6336e5e9a28be..06287fcd2e3850ebd016c6ee0daf9cc07136b5e9 100644 (file)
@@ -233,7 +233,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
       escaped_where_name = escape_filename(rx.RegexWhere);
       Mmsg(ua->cmd,
           "run job=\"%s\" client=\"%s\" restoreclient=\"%s\" storage=\"%s\""
-          " bootstrap=\"%s\" regexwhere=\"%s\" files=%d catalog=\"%s\"",
+          " bootstrap=\"%s\" regexwhere=\"%s\" files=%u catalog=\"%s\"",
           job->name(), rx.ClientName, rx.RestoreClientName, 
           rx.store?rx.store->name():"",
           escaped_bsr_name ? escaped_bsr_name : jcr->RestoreBootstrap,
@@ -244,7 +244,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
       escaped_where_name = escape_filename(rx.where);
       Mmsg(ua->cmd,
           "run job=\"%s\" client=\"%s\" restoreclient=\"%s\" storage=\"%s\""
-          " bootstrap=\"%s\" where=\"%s\" files=%d catalog=\"%s\"",
+          " bootstrap=\"%s\" where=\"%s\" files=%u catalog=\"%s\"",
           job->name(), rx.ClientName, rx.RestoreClientName,
           rx.store?rx.store->name():"",
           escaped_bsr_name ? escaped_bsr_name : jcr->RestoreBootstrap,
@@ -254,7 +254,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
    } else {
       Mmsg(ua->cmd,
           "run job=\"%s\" client=\"%s\" restoreclient=\"%s\" storage=\"%s\""
-          " bootstrap=\"%s\" files=%d catalog=\"%s\"",
+          " bootstrap=\"%s\" files=%u catalog=\"%s\"",
           job->name(), rx.ClientName, rx.RestoreClientName,
           rx.store?rx.store->name():"",
           escaped_bsr_name ? escaped_bsr_name : jcr->RestoreBootstrap,
index 920fdb1b240c9204cf9720bdca5698a963426b55..e2a05f6b6288b16b253e1e7c8fd3f4b7015f95b8 100644 (file)
@@ -77,7 +77,7 @@ static int32_t fmtfp(char *buffer, int32_t currlen, int32_t maxlen,
 #define fmtfp(b, c, m, f, min, max, fl) currlen
 #endif
 
-#define outch(c) {int len=currlen; if (currlen++ < maxlen) { buffer[len] = (c);}}
+#define outch(c) {if (currlen < maxlen) { buffer[currlen++] = (c);}}
 
 
 /* format read states */
@@ -152,9 +152,9 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args)
    *buffer = 0;
 
    while (state != DP_S_DONE) {
-      if ((ch == '\0') || (currlen >= maxlen))
+      if ((ch == '\0') || (currlen >= maxlen)) {
          state = DP_S_DONE;
-
+      }
       switch (state) {
       case DP_S_DEFAULT:
          if (ch == '%') {
@@ -444,11 +444,12 @@ static int32_t fmtint(char *buffer, int32_t currlen, int32_t maxlen,
 {
    int signvalue = 0;
    uint64_t uvalue;
-   char convert[20];
+   char convert[25];
    int place = 0;
    int spadlen = 0;                /* amount to space pad */
    int zpadlen = 0;                /* amount to zero pad */
    int caps = 0;
+   const char *cvt_string;
 
    if (max < 0) {
       max = 0;
@@ -471,12 +472,12 @@ static int32_t fmtint(char *buffer, int32_t currlen, int32_t maxlen,
       caps = 1;                    /* Should characters be upper case? */
    }
 
+   cvt_string = caps ? "0123456789ABCDEF" : "0123456789abcdef";
    do {
-      convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
-         [uvalue % (unsigned)base];
+      convert[place++] = cvt_string[uvalue % (unsigned)base];
       uvalue = (uvalue / (unsigned)base);
-   } while (uvalue && (place < 20));
-   if (place == 20) {
+   } while (uvalue && (place < (int)sizeof(convert)));
+   if (place == (int)sizeof(convert)) {
       place--;
    }
    convert[place] = 0;
index 45001b9574f3bf75399ec3a2a0a3e22e31301790..a47573a231cc3b1c61e0a6d59a08e3519d01f1b4 100644 (file)
@@ -1,6 +1,10 @@
               Technical notes on version 2.2
 
 General:
+23Dec07
+kes  Attempt to eliminate seg fault Frank Sweetser is seeing in
+     running the regression tests on his Fedora systems.  It seems
+     to be related to bsnprintf and long path names.
 14Dec07
 kes  Apply patch from  Michael Stapelberg <michael@stapelberg.de>
      that implements double quoting include names in conf files,