From 6b1b8fef55446dc80cca5fae5b1662a5823900e1 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 17 Jun 2023 12:05:13 +0200 Subject: [PATCH] fix: Don't create . or .. in the untar example --- examples/untar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/untar.c b/examples/untar.c index 8d43272..843a2fa 100644 --- a/examples/untar.c +++ b/examples/untar.c @@ -88,6 +88,7 @@ int main(int argc, char** argv) { if (entry.metadata.type == MTAR_DIRECTORY) { + if (!strcmp(entry.metadata.name, ".") || !strcmp(entry.metadata.name, "..")) continue; int status = untar_directory(&entry); if (status != 0) { @@ -223,4 +224,4 @@ int main(int argc, char** argv) } while (1); minitar_close(&mp); return exit_status; -} \ No newline at end of file +}