]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix additional counter problem + fix pathconf() error bug
authorKern Sibbald <kern@sibbald.com>
Wed, 10 Sep 2003 16:29:12 +0000 (16:29 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 10 Sep 2003 16:29:12 +0000 (16:29 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@695 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/dird/dird.c
bacula/src/dird/dird_conf.c
bacula/src/dird/expand.c
bacula/src/findlib/find.c
bacula/src/findlib/find_one.c

index b5c8b1e9adb3ed194be8d0feb9da4622f3c314f9..5f8707e45c362dfa6a4da09005ad240884b4bc62 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                 9 September 2003 
+                10 September 2003 
 
 Documentation to do: (any release a little bit at a time)
 - Document running a test version.
index 91d7dd4e0afa9a08e7dcaf9f9f24cce6c2ec0e7d..eb0a4758ecf612b5e77c7990d39522f240010132 100644 (file)
@@ -398,9 +398,10 @@ Without that I don't know who I am :-(\n"), configfile);
                  if (db_create_counter_record(NULL, db, &cr)) {
                     counter->CurrentValue = cr.CurrentValue;
                     counter->created = true;
-//                   Dmsg2(000, "Create counter %s val=%d\n", counter->hdr.name, counter->CurrentValue);
+                     Dmsg2(100, "Create counter %s val=%d\n", counter->hdr.name, counter->CurrentValue);
                  }
-              } else {
+              } 
+              if (!counter->created) {
                  counter->CurrentValue = counter->MinValue;  /* default value */
               }
            }
index e455804ec74ef3717e32101c93800d9846f1a6b3..00a8f9c7e52cc3cd5518bc7c1db98bf0b67aa273 100644 (file)
@@ -432,9 +432,10 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...
       break;
    case R_COUNTER:
       if (res->res_counter.WrapCounter) {
-         sendit(sock, "Counter: name=%s min=%d max=%d wrapcntr=%s\n",
+         sendit(sock, "Counter: name=%s min=%d max=%d cur=%d wrapcntr=%s\n",
            res->res_counter.hdr.name, res->res_counter.MinValue, 
-           res->res_counter.MaxValue, res->res_counter.WrapCounter->hdr.name);
+           res->res_counter.MaxValue, res->res_counter.CurrentValue,
+           res->res_counter.WrapCounter->hdr.name);
       } else {
          sendit(sock, "Counter: name=%s min=%d max=%d\n",
            res->res_counter.hdr.name, res->res_counter.MinValue, 
index 4002dbb34ace3ecd81151a944b1dcfc9eac2741e..265faa767808d39870e3c14b77dd82ba284b91f7 100644 (file)
@@ -195,11 +195,12 @@ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx,
    LockRes();
    for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) {
       if (strcmp(counter->hdr.name, buf) == 0) {
+         Dmsg2(100, "Counter=%s val=%d\n", buf, counter->CurrentValue);
          bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue);
         *val_ptr = bstrdup(buf);
         *val_len = strlen(buf);
         *val_size = *val_len;
-        if (var_inc) {
+        if (var_inc && counter->Catalog) {
            COUNTER_DBR cr;
            JCR *jcr = (JCR *)my_ctx;
            memset(&cr, 0, sizeof(cr));
@@ -212,6 +213,7 @@ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx,
               counter->CurrentValue++;
            }
            cr.CurrentValue = counter->CurrentValue;
+            Dmsg1(100, "New value=%d\n", cr.CurrentValue);
            if (counter->WrapCounter) {
               bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
            } else {
@@ -258,7 +260,7 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx,
    }
    memcpy(buf, var_ptr, var_len + 1);
    buf[var_len] = 0;
-// Dmsg1(000, "Var=%s\n", buf);
+   Dmsg1(100, "Var=%s\n", buf);
 
    if ((val = getenv(buf)) == NULL) {
        return VAR_ERR_UNDEFINED_VARIABLE;
@@ -280,8 +282,8 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx,
       }
    }
    count++;
-// Dmsg3(000, "For %s, reqest index=%d have=%d\n",
-//    buf, var_index, count);
+   Dmsg3(100, "For %s, reqest index=%d have=%d\n",
+      buf, var_index, count);
    if (var_index < 0 || var_index > count) {
       return VAR_ERR_SUBMATCH_OUT_OF_RANGE;
    }
@@ -301,7 +303,7 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx,
    if (p-val > (int)sizeof(buf) - 1) {
        return VAR_ERR_OUT_OF_MEMORY;
    }
-// Dmsg2(000, "val=%s len=%d\n", val, p-val);
+   Dmsg2(100, "val=%s len=%d\n", val, p-val);
    /* Make a copy of item, and pass it back */
    v = (char *)malloc(p-val+1);
    memcpy(v, val, p-val);
@@ -309,7 +311,7 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx,
    *val_ptr = v;
    *val_len = p-val;
    *val_size = p-val;
-// Dmsg1(000, "v=%s\n", v);
+   Dmsg1(100, "v=%s\n", v);
    return VAR_OK;
 }
 
@@ -327,7 +329,7 @@ static var_rc_t operate_var(var_t *var, void *my_ctx,
          char **out_ptr, int *out_len, int *out_size)
 {
    var_rc_t stat = VAR_ERR_UNDEFINED_OPERATION;
-// Dmsg0(000, "Enter operate_var\n");
+   Dmsg0(100, "Enter operate_var\n");
    if (!val_ptr) {
       *out_size = 0;
       return stat;
@@ -339,14 +341,14 @@ static var_rc_t operate_var(var_t *var, void *my_ctx,
       }
       memcpy(buf, arg_ptr, arg_len);
       buf[arg_len] = 0;
-//    Dmsg1(000, "Arg=%s\n", buf);
+      Dmsg1(100, "Arg=%s\n", buf);
       memcpy(buf, val_ptr, val_len);
       buf[val_len] = 0;   
-//    Dmsg1(000, "Val=%s\n", buf);
+      Dmsg1(100, "Val=%s\n", buf);
       LockRes();
       for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) {
         if (strcmp(counter->hdr.name, buf) == 0) {
-//          Dmsg2(000, "counter=%s val=%s\n", counter->hdr.name, buf);
+            Dmsg2(100, "counter=%s val=%s\n", counter->hdr.name, buf);
            break;
         }
       }
index e4d544e27469017c81e8d4d8c5ff45b78dd87d70..9a52dbd4c461d1b925e59ea44d303a5091bd8eb5 100644 (file)
@@ -29,8 +29,8 @@
 #include "find.h"
 
 
-size_t name_max;              /* filename max length */
-size_t path_max;              /* path name max length */
+int32_t name_max;             /* filename max length */
+int32_t path_max;             /* path name max length */
 
 
 /* ****FIXME**** debug until stable */
index f10b80b79598db89ceb02ecb56b7b0bf2dbaa957..ff1c0df4424c08f5e40c252791ac93da74622ea0 100755 (executable)
@@ -28,8 +28,8 @@
 #include "bacula.h"
 #include "find.h"
 
-extern size_t name_max;              /* filename max length */
-extern size_t path_max;              /* path name max length */
+extern int32_t name_max;             /* filename max length */
+extern int32_t path_max;             /* path name max length */
 
 /*
  * Structure for keeping track of hard linked files, we   
@@ -329,7 +329,7 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt),
         if (status != 0 || result == NULL) {
            break;
         }
-        ASSERT(name_max+1 > sizeof(struct dirent) + (int)NAMELEN(entry));
+        ASSERT(name_max+1 > (int)sizeof(struct dirent) + (int)NAMELEN(entry));
         p = entry->d_name;
          /* Skip `.', `..', and excluded file names.  */
          if (p[0] == '\0' || (p[0] == '.' && (p[1] == '\0' ||