]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Do not add an empty Storage line when generating the BSR
authorEric Bollengier <eric@baculasystems.com>
Mon, 23 May 2022 10:04:26 +0000 (12:04 +0200)
committerEric Bollengier <eric@baculasystems.com>
Fri, 27 May 2022 08:32:14 +0000 (10:32 +0200)
After a bscan, the catalog may not have the information about the
storage resource to use for a volume. In that case, we skip the Storage=
line.

bacula/src/dird/bsr.c

index 25f90c26017d0dbeda68d98c8cef50cabea7890c..f97e61b173f68ce9e3fa928b39a17338423d1952 100644 (file)
@@ -367,7 +367,9 @@ static uint32_t write_bsr_item(RBSR *bsr, UAContext *ua,
          find_storage_resource(ua, rx, bsr->VolParams[i].Storage,
                                        bsr->VolParams[i].MediaType);
       }
-      fprintf(fd, "Storage=\"%s\"\n", bsr->VolParams[i].Storage);
+      if (strcmp(bsr->VolParams[i].Storage, "") != 0) {
+         fprintf(fd, "Storage=\"%s\"\n", bsr->VolParams[i].Storage);
+      }
       fprintf(fd, "Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
       fprintf(fd, "MediaType=\"%s\"\n", bsr->VolParams[i].MediaType);
       if (bsr->fileregex) {