]> git.sur5r.net Git - bacula/bacula/commitdiff
On restore we don't have a full FF_PKT so we lstat the file.
authorMarco van Wieringen <mvw@planets.elm.net>
Fri, 16 Sep 2011 15:13:48 +0000 (17:13 +0200)
committerMarco van Wieringen <mvw@planets.elm.net>
Fri, 16 Sep 2011 19:51:40 +0000 (21:51 +0200)
bacula/src/filed/acl.c
bacula/src/filed/xattr.c

index 3f50cba90e43daec228ddf45b3ca83715e6c3e6e..27696fdc52fa09014f2ad52a237876862ad94b47 100644 (file)
@@ -1850,15 +1850,35 @@ bacl_exit_code build_acl_streams(JCR *jcr, FF_PKT *ff_pkt)
 
 bacl_exit_code parse_acl_streams(JCR *jcr, int stream)
 {
+   int ret;
+   berrno be;
+   struct stat st;
    unsigned int cnt;
 
    /*
     * See if we are changing from one device to an other.
     * We save the current device we are restoring to and compare
     * it with the current st_dev in the last stat performed on
-    * the file we are currently storing.
+    * the file we are currently restoring.
     */
-   if (jcr->acl_data->current_dev != ff_pkt->statp.st_dev) {
+   ret = lstat(jcr->last_fname, &st);
+   switch (ret) {
+   case -1:
+      switch (errno) {
+      case ENOENT:
+         return bacl_exit_ok;
+      default:
+         Mmsg2(jcr->errmsg, _("Unable to stat file \"%s\": ERR=%s\n"),
+               jcr->last_fname, be.bstrerror());
+         Dmsg2(100, "Unable to stat file \"%s\": ERR=%s\n",
+               jcr->last_fname, be.bstrerror());
+         return bacl_exit_error;
+      }
+      break;
+   case 0:
+      break;
+   }
+   if (jcr->acl_data->current_dev != st.st_dev) {
       /*
        * Reset the acl save flags.
        */
@@ -1866,9 +1886,9 @@ bacl_exit_code parse_acl_streams(JCR *jcr, int stream)
       jcr->acl_data->flags |= BACL_FLAG_RESTORE_NATIVE;
 
       /*
-       * Save that we started retoring to a new filesystem.
+       * Save that we started restoring to a new filesystem.
        */
-      jcr->acl_data->current_dev = ff_pkt->statp.st_dev;
+      jcr->acl_data->current_dev = st.st_dev;
    }
 
    switch (stream) {
index b1f19fc9808f1abee1799033fa167f9c0711e91f..ac364dd10f5689c93e8c40899f79bc86e7987ad8 100644 (file)
@@ -3361,15 +3361,35 @@ bxattr_exit_code build_xattr_streams(JCR *jcr, FF_PKT *ff_pkt)
 
 bxattr_exit_code parse_xattr_streams(JCR *jcr, int stream)
 {
+   int ret;
+   berrno be;
+   struct stat st;
    unsigned int cnt;
 
    /*
     * See if we are changing from one device to an other.
     * We save the current device we are restoring to and compare
     * it with the current st_dev in the last stat performed on
-    * the file we are currently storing.
+    * the file we are currently restoring.
     */
-   if (jcr->xattr_data->current_dev != ff_pkt->statp.st_dev) {
+   ret = lstat(jcr->last_fname, &st);
+   switch (ret) {
+   case -1:
+      switch (errno) {
+      case ENOENT:
+         return bxattr_exit_ok;
+      default:
+         Mmsg2(jcr->errmsg, _("Unable to stat file \"%s\": ERR=%s\n"),
+               jcr->last_fname, be.bstrerror());
+         Dmsg2(100, "Unable to stat file \"%s\": ERR=%s\n",
+               jcr->last_fname, be.bstrerror());
+         return bxattr_exit_error;
+      }
+      break;
+   case 0:
+      break;
+   }
+   if (jcr->xattr_data->current_dev != st.st_dev) {
       /*
        * Reset the acl save flags.
        */
@@ -3379,9 +3399,12 @@ bxattr_exit_code parse_xattr_streams(JCR *jcr, int stream)
       /*
        * Save that we started restoring to a new filesystem.
        */
-      jcr->xattr_data->current_dev = ff_pkt->statp.st_dev;
+      jcr->xattr_data->current_dev = st.st_dev;
    }
 
+   /*
+    * See if we are still restoring native xattr to this filesystem.
+    */
    if ((jcr->xattr_data->flags & BXATTR_FLAG_RESTORE_NATIVE) && os_parse_xattr_streams) {
       /*
        * See if we can parse this stream, and ifso give it a try.