nlitsme / extfstools

Tools for extracting files from ext2,3,4 filesystem images
MIT License
121 stars 39 forks source link

Symlinks are not exported #5

Closed sudopk closed 4 years ago

sudopk commented 4 years ago

Thanks for the great tool.

E.g. if I run: mkdir outdir ext2rd ./:outdir

Symlink (valid or broken) are not exported. I would expect symlinks (whether valid or broken) to be exported.

Seems like export ignores the symlinks. Only directories and regular files are processed. In ext2rd.cpp, near line 1063:

    recursedirs(fs, ino, ".", [&](const DirectoryEntry& e, const std::string& path) {
        if (e.filetype==EXT4_FT_DIR) {
            if (-1==mkdir((savepath+"/"+path+"/"+e.name).c_str(), 0777)) {
                perror("mkdir(savepath)");
            }
        }
        else if (e.filetype==EXT4_FT_REG_FILE) {
            exportinode byino(e.inode, savepath+"/"+path+"/"+e.name);
            byino.perform(fs);
        }
    });
nlitsme commented 4 years ago

thanks, merged your PR