]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix off by one for last Slot of autochanger for label.
authorKern Sibbald <kern@sibbald.com>
Fri, 4 Nov 2005 15:53:48 +0000 (15:53 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 4 Nov 2005 15:53:48 +0000 (15:53 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2539 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/ua_label.c

index eb99e716c2625556d4ab79547951940ac20e765e..00889c90acdae2044ee615f388325cbed92dcab9 100644 (file)
@@ -66,11 +66,12 @@ static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots)
    int i;
    const char *msg;
 
+   /* slots are numbered 1 to num_slots */
    for (int i=0; i <= num_slots; i++) {
       slot_list[i] = 0;
    }
    i = find_arg_with_value(ua, "slots");
-   if (i >= 0) {
+   if (i > 0) {
       /* scan slot list in ua->argv[i] */
       char *p, *e, *h;
       int beg, end;
@@ -117,7 +118,7 @@ static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots)
             msg = _("Values must be be greater than zero.\n");
             goto bail_out;
          }
-         if (end >= num_slots) {
+         if (end > num_slots) {
             msg = _("Slot too large.\n");
             goto bail_out;
          }
@@ -127,14 +128,14 @@ static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots)
       }
    } else {
       /* Turn everything on */
-      for (i=0; i <= num_slots; i++) {
+      for (i=1; i <= num_slots; i++) {
          slot_list[i] = 1;
       }
    }
    Dmsg0(100, "Slots turned on:\n");
    for (i=1; i <= num_slots; i++) {
       if (slot_list[i]) {
-         Dmsg1(100, "%d\n", i);
+         Dmsg1(000, "%d\n", i);
       }
    }
    return true;