summaryrefslogtreecommitdiff
path: root/Userland/Utilities/tar.cpp
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2021-11-22 21:17:24 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-22 21:57:42 +0100
commit75978d5fff3a568bc1ed096ebe0ee6f83446def4 (patch)
treeae3029c7a4cd9821232d1c0d459549f4a8afdf4e /Userland/Utilities/tar.cpp
parenta0c80a6f17ce4e4e45e667a2b824931b9845ff9f (diff)
downloadserenity-75978d5fff3a568bc1ed096ebe0ee6f83446def4.zip
tar: Support extracting symlinks
We can now extract GitHub's LLVM tarballs. :^)
Diffstat (limited to 'Userland/Utilities/tar.cpp')
-rw-r--r--Userland/Utilities/tar.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp
index 09b18146e2..fc98681a84 100644
--- a/Userland/Utilities/tar.cpp
+++ b/Userland/Utilities/tar.cpp
@@ -105,6 +105,16 @@ int main(int argc, char** argv)
close(fd);
break;
}
+ case Archive::TarFileType::SymLink: {
+ Core::File::ensure_parent_directories(absolute_path);
+
+ if (symlink(header.link_name().to_string().characters(), absolute_path.characters())) {
+ perror("symlink");
+ return 1;
+ }
+
+ break;
+ }
case Archive::TarFileType::Directory: {
Core::File::ensure_parent_directories(absolute_path);