]> git.pld-linux.org Git - packages/extundelete.git/blobdiff - extundelete-dirs.patch
- restore atime, mtime, mode, user, group and directories, print dtime, rel. 2
[packages/extundelete.git] / extundelete-dirs.patch
diff --git a/extundelete-dirs.patch b/extundelete-dirs.patch
new file mode 100644 (file)
index 0000000..0dfa785
--- /dev/null
@@ -0,0 +1,27 @@
+diff -urNp a/src/extundelete.cc b/src/extundelete.cc
+--- a/src/extundelete.cc       2010-05-16 03:51:15.000000000 +0200
++++ b/src/extundelete.cc       2012-01-01 22:51:46.000000000 +0100
+@@ -2556,6 +2556,23 @@ int restore_inode(ext2_filsys fs, ext2_f
+                       retval = EU_RESTORE_FAIL;
+               }
+       }
++      else if (LINUX_S_ISDIR(inode->i_mode)) {
++              if(mkdir((outputdir2 + fname2).c_str(), 0700)) {
++                      struct timeval times[2];
++                      chmod((outputdir + fname2).c_str(),inode->i_mode);
++                      lchown((outputdir + fname2).c_str(),inode->i_uid,inode->i_gid);
++                      times[0].tv_sec=inode->i_atime; times[0].tv_usec=0;
++                      times[1].tv_sec=inode->i_mtime; times[1].tv_usec=0;
++                      utimes((outputdir + fname2).c_str(),times);
++                      std::cout << "Restored inode " << ino << " as directory ";
++                      std::cout << (outputdir + fname2) << " deleted " << asctime(localtime((time_t*)&inode->i_dtime));
++                      retval = 0;
++              } else {
++                      std::cout << "Failed to restore inode " << ino << " as directory ";
++                      std::cout << (outputdir + fname2) << " deleted " << asctime(localtime((time_t*)&inode->i_dtime));
++                      retval = EU_RESTORE_FAIL;
++              }
++      }
+       else {
+               std::cout << "Failed to restore inode " << ino << " to file ";
+               std::cout << (outputdir + fname2) << ":";
This page took 0.068999 seconds and 4 git commands to generate.