From: Tom Gundersen <teg@xxxxxxx> Allows us to drop call to "mkdir -p" from the systemd service file. --- tools/static-nodes.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/static-nodes.c b/tools/static-nodes.c index 351c02b..0195390 100644 --- a/tools/static-nodes.c +++ b/tools/static-nodes.c @@ -154,12 +154,11 @@ static void help(void) static int do_static_nodes(int argc, char *argv[]) { struct utsname kernel; - char modules[PATH_MAX]; + char modules[PATH_MAX], buf[4096]; const char *output = "/dev/stdout"; FILE *in = NULL, *out = NULL; const struct static_nodes_format *format = &static_nodes_format_human; - char buf[4096]; - int ret = EXIT_SUCCESS; + int r, ret = EXIT_SUCCESS; for (;;) { int c, idx = 0, valid; @@ -227,6 +226,13 @@ static int do_static_nodes(int argc, char *argv[]) goto finish; } + r = mkdir_parents(output, 0755); + if (r < 0) { + fprintf(stderr, "Error: could not create parent directory for %s - %m.\n", output); + ret = EXIT_FAILURE; + goto finish; + } + out = fopen(output, "we"); if (out == NULL) { fprintf(stderr, "Error: could not create %s - %m\n", output); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html