fix: Don't create . or .. in the untar example

This commit is contained in:
apio 2023-06-17 12:05:13 +02:00
parent cd0c5df5f5
commit 6b1b8fef55
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -88,6 +88,7 @@ int main(int argc, char** argv)
{ {
if (entry.metadata.type == MTAR_DIRECTORY) if (entry.metadata.type == MTAR_DIRECTORY)
{ {
if (!strcmp(entry.metadata.name, ".") || !strcmp(entry.metadata.name, "..")) continue;
int status = untar_directory(&entry); int status = untar_directory(&entry);
if (status != 0) if (status != 0)
{ {
@ -223,4 +224,4 @@ int main(int argc, char** argv)
} while (1); } while (1);
minitar_close(&mp); minitar_close(&mp);
return exit_status; return exit_status;
} }