]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Use bfopen instead of fopen in various tools
authorEric Bollengier <eric@baculasystems.com>
Thu, 4 Jul 2024 12:32:12 +0000 (14:32 +0200)
committerEric Bollengier <eric@baculasystems.com>
Wed, 4 Dec 2024 08:14:26 +0000 (09:14 +0100)
bacula/src/dird/malware.c
bacula/src/filed/job.c
bacula/src/lib/lex.c
bacula/src/plugins/fd/fd_common.h
bacula/src/tools/bsnapshot.c

index d484c9e8645fafbe71e87cb17f1b6eb9338926b7..05e85fb152158a67c16b0910ab025522475eddda 100644 (file)
@@ -69,7 +69,7 @@ static bool load_malware_db(JCR *jcr, BDB *db, int mode, const char *source, con
    Dmsg1(dbglvl, "Load malware database from %s\n", fname);
 
    /* We open the malware hash database */
-   fp = fopen(fname, "r");
+   fp = bfopen(fname, "r");
    if (!fp) {
       berrno be;
       Mmsg(errmsg, _("[DE0053] Unable to open the Malware Database export %s ERR=%s\n"),
index 751c192a32eb3a010201c1d2024e6248b79a9da2..943f471ace95c6cc01d0bb85e60cc407f5df427f 100644 (file)
@@ -1505,7 +1505,7 @@ int add_file_to_fileset(JCR *jcr, const char *fname, bool is_file)
    case '<':
       Dmsg1(100, "Doing < of '%s' include on client.\n", p + 1);
       p++;                      /* skip over < */
-      if ((ffd = fopen(p, "rb")) == NULL) {
+      if ((ffd = bfopen(p, "rb")) == NULL) {
          berrno be;
          Jmsg(jcr, M_FATAL, 0,
               _("Cannot open FileSet input file: %s. ERR=%s\n"),
index c7ff1914b6efdfd5794eb7f45a1262e934db70a8..0792ab20284218b87109da7c8c3d3ac32617f46a 100644 (file)
@@ -247,7 +247,7 @@ LEX *lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error)
          return NULL;
       }
       fd = bpipe->rfd;
-   } else if ((fd = fopen(fname, "rb")) == NULL) {
+   } else if ((fd = bfopen(fname, "rb")) == NULL) {
       free(fname);
       return NULL;
    }
index da85457df3360727ddf475f7ccb4eb309cfb3478..7175389921f7c67f36c3880b11be49ceca8e464d 100644 (file)
@@ -337,7 +337,7 @@ bool joblist::find_job(const char *name, POOLMEM **data)
    Mmsg(tmp, "%s/%s", working, base);
 
    P(joblist_mutex);
-   f = fopen(tmp, "r");
+   f = bfopen(tmp, "r");
    if (!f) {
       berrno be;
       Jmsg(ctx, M_ERROR, "Unable to open job database. ERR=%s\n",
@@ -432,7 +432,7 @@ bool joblist::find_root_job()
    Mmsg(tmp, "%s/%s", working, base);
 
    P(joblist_mutex);
-   f = fopen(tmp, "r");
+   f = bfopen(tmp, "r");
    if (!f) {
       berrno be;
       Jmsg(ctx, M_ERROR, "Unable to prune previous jobs. ERR=%s\n",
@@ -513,7 +513,7 @@ bool joblist::store_job(char *data)
 
    tmp = get_pool_memory(PM_FNAME);
    Mmsg(tmp, "%s/%s", working, base);
-   fp = fopen(tmp, "a+");
+   fp = bfopen(tmp, "a+");
    if (!fp) {
       berrno be;
       Jmsg(ctx, M_ERROR, "Unable to update the job history. ERR=%s\n",
@@ -600,7 +600,7 @@ void joblist::prune_jobs(char *build_cmd(void *arg, const char *data, const char
    *curkey = *curjobname = *prevjob = *rootjob = *buf = *data = 0;
 
    P(joblist_mutex);
-   fout = fopen(tmpout, "w");
+   fout = bfopen(tmpout, "w");
    if (!fout) {
       berrno be;
       Jmsg(ctx, M_ERROR, "Unable to prune previous jobs. "
@@ -609,7 +609,7 @@ void joblist::prune_jobs(char *build_cmd(void *arg, const char *data, const char
       goto bail_out;
    }
 
-   f = fopen(tmp, "r");
+   f = bfopen(tmp, "r");
    if (!f) {
       berrno be;
       Jmsg(ctx, M_ERROR, "Unable to prune previous jobs. ERR=%s\n",
index 2bdd90b2a7305cc451dc21230730df8d12fe4792..6241fa69d47de8dbf29a28a850b9e2459331577a 100644 (file)
@@ -666,7 +666,7 @@ public:
        */
       Mmsg(path, "%s/snapshotdb/%s", arg->working, arg->name);
       if (stat(path, &sp) == 0) {
-         FILE *fp = fopen(path, "r");
+         FILE *fp = bfopen(path, "r");
          if (!fp) {
             printf("status=0 error=\"Unable to get information about snapshot\n");
             return 0;
@@ -701,7 +701,7 @@ public:
          return 0;
       }
 
-      FILE *fp = fopen(path, "w");
+      FILE *fp = bfopen(path, "w");
       if (!fp) {
          berrno be;
          printf("status=0 error=\"Unable to store information about snapshot in %s errno=%s\"\n", path, be.bstrerror());