From 5bece6bf8c66ade0960290b6fe75623da7968e09 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Fri, 9 Feb 2018 11:10:31 +0100 Subject: [PATCH] firmware: fix firmware extraction --- src/filesystem.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/filesystem.c b/src/filesystem.c index da3cf76..f0465a8 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -163,11 +163,19 @@ void list_files(uint8_t *fw, int32_t len) void mkdir_p(char *dir) { char *parent; + char *tmpdir; if ((dir == NULL) || (!strcmp(dir, "."))) return; - parent = strdup(dirname(dir)); + tmpdir = strdup(dir); + if (tmpdir == NULL) { + perror("strdup"); + exit(1); + } + + parent = strdup(dirname(tmpdir)); + free(tmpdir); if (parent == NULL) { perror("strdup"); exit(1); -- 2.39.5