From: Michael Gernoth Date: Fri, 9 Feb 2018 10:10:31 +0000 (+0100) Subject: firmware: fix firmware extraction X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/5bece6bf8c66ade0960290b6fe75623da7968e09?ds=sidebyside firmware: fix firmware extraction --- 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);