]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix bug #2212 where restore jobid=nn file=xxx restores the files twice
authorKern Sibbald <kern@sibbald.com>
Sun, 27 May 2018 17:44:09 +0000 (19:44 +0200)
committerKern Sibbald <kern@sibbald.com>
Sun, 27 May 2018 18:01:53 +0000 (20:01 +0200)
bacula/src/dird/ua_restore.c

index b5b8dac2c8bfab1553d229051da760c9b1e7544a..04bd5ae8a5f6710b1e50bc913030763d05245105 100644 (file)
@@ -1005,6 +1005,13 @@ static bool insert_file_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *f
    } else {
       Mmsg(rx->query, uar_jobids_fileindex, rx->JobIds, date,
            rx->path, rx->fname, rx->ClientName);
+      /*
+       * Note: we have just edited the JobIds into the query, so
+       *  we need to clear JobIds, or they will be added
+       *  back into JobIds with the query below, and then
+       *  restored twice.  Fixes bug #2212.
+       */
+      rx->JobIds[0] = 0;
    }
    rx->found = false;
    /* Find and insert jobid and File Index */