+2020-10-27 Érico N. Rolim <erico.erc@gmail.com>
+
+ * unstrip.c (make_directories): Use strndup, not strndupa.
+
2020-09-28 Mark Wielaard <mark@klomp.org>
* readelf.c (next_listptr_offset): Take idx as pointer, to be updated
if (lastslash == path)
return;
- char *dir = strndupa (path, lastslash - path);
+ char *dir = strndup (path, lastslash - path);
+ if (dir == NULL)
+ error(EXIT_FAILURE, errno, _("memory exhausted"));
+
while (mkdir (dir, 0777) < 0 && errno != EEXIST)
- if (errno == ENOENT)
- make_directories (dir);
- else
- error (EXIT_FAILURE, errno, _("cannot create directory '%s'"), dir);
+ {
+ if (errno == ENOENT)
+ make_directories (dir);
+ else
+ error (EXIT_FAILURE, errno, _("cannot create directory '%s'"), dir);
+ }
+ free (dir);
}
/* Keep track of new section data we are creating, so we can free it