]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/bextract.c
ebl Fix a bug in read_close_session which return random status
[bacula/bacula] / bacula / src / stored / bextract.c
index 2c7d1ecc2ac4ff0c0ff753e15deb1d9f60b6e180..6d6cba94f95c31ae6fd024310764112c8d02006c 100644 (file)
@@ -16,8 +16,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -85,7 +85,7 @@ PROG_COPYRIGHT
 "       -p              proceed inspite of I/O errors\n"
 "       -v              verbose\n"
 "       -V <volumes>    specify Volume names (separated by |)\n"
-"       -?              print this message\n\n"), BYEAR, VERSION, BDATE);
+"       -?              print this message\n\n"), 2000, VERSION, BDATE);
    exit(1);
 }
 
@@ -135,7 +135,7 @@ int main (int argc, char *argv[])
          if ((fd = fopen(optarg, "rb")) == NULL) {
             berrno be;
             Pmsg2(0, _("Could not open exclude file: %s, ERR=%s\n"),
-               optarg, be.strerror());
+               optarg, be.bstrerror());
             exit(1);
          }
          while (fgets(line, sizeof(line), fd) != NULL) {
@@ -150,7 +150,7 @@ int main (int argc, char *argv[])
          if ((fd = fopen(optarg, "rb")) == NULL) {
             berrno be;
             Pmsg2(0, _("Could not open include file: %s, ERR=%s\n"),
-               optarg, be.strerror());
+               optarg, be.bstrerror());
             exit(1);
          }
          while (fgets(line, sizeof(line), fd) != NULL) {
@@ -220,6 +220,9 @@ int main (int argc, char *argv[])
 static void do_extract(char *devname)
 {
    struct stat statp;
+
+   enable_backup_privileges(NULL, 1);
+
    jcr = setup_jcr("bextract", devname, bsr, VolumeName, 1); /* acquire for read */
    if (!jcr) {
       exit(1);
@@ -234,7 +237,7 @@ static void do_extract(char *devname)
    if (stat(where, &statp) < 0) {
       berrno be;
       Emsg2(M_ERROR_TERM, 0, _("Cannot stat %s. It must exist. ERR=%s\n"),
-         where, be.strerror());
+         where, be.bstrerror());
    }
    if (!S_ISDIR(statp.st_mode)) {
       Emsg1(M_ERROR_TERM, 0, _("%s must be a directory.\n"), where);
@@ -355,7 +358,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                if (blseek(&bfd, (boffset_t)fileAddr, SEEK_SET) < 0) {
                   berrno be;
                   Emsg2(M_ERROR_TERM, 0, _("Seek error on %s: %s\n"),
-                     attr->ofname, be.strerror());
+                     attr->ofname, be.bstrerror());
                }
             }
          } else {
@@ -367,7 +370,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          if ((uint32_t)bwrite(&bfd, wbuf, wsize) != wsize) {
             berrno be;
             Emsg2(M_ERROR_TERM, 0, _("Write error on %s: %s\n"),
-               attr->ofname, be.strerror());
+               attr->ofname, be.bstrerror());
          }
          fileAddr += wsize;
       }
@@ -395,7 +398,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
                if (blseek(&bfd, (boffset_t)fileAddr, SEEK_SET) < 0) {
                   berrno be;
                   Emsg3(M_ERROR, 0, _("Seek to %s error on %s: ERR=%s\n"),
-                     edit_uint64(fileAddr, ec1), attr->ofname, be.strerror());
+                     edit_uint64(fileAddr, ec1), attr->ofname, be.bstrerror());
                   extract = false;
                   return true;
                }
@@ -417,7 +420,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
             berrno be;
             Pmsg0(0, _("===Write error===\n"));
             Emsg2(M_ERROR, 0, _("Write error on %s: %s\n"),
-               attr->ofname, be.strerror());
+               attr->ofname, be.bstrerror());
             extract = false;
             return true;
          }