From 383bd1c5033b466ffcc1a0be766d8a8b003c73e9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 6 Dec 2001 08:49:08 +0000 Subject: Update. 2001-12-06 Ulrich Drepper * libio/vasprintf.c (_IO_vasprintf): Free buffer on failure. * assert/assert.c: Check result of __asprintf call and don't use string if it failed. * assert/assert-perr.c: Likewise. * inet/rcmd.c: Likewise. * locale/programs/localedef.c (main): Check result of construct_output_path and exit if it failed. (construct_output_path): Check result of asprintf and mkdir calls and fail if they failed. * posix/getopt.c: Check result of __asprintf calls and fail if they failed. Patch by Dmitry V. Levin . --- locale/programs/localedef.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'locale/programs') diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c index 180e82c1ba..62dbc1aafc 100644 --- a/locale/programs/localedef.c +++ b/locale/programs/localedef.c @@ -177,6 +177,8 @@ main (int argc, char *argv[]) /* The parameter describes the output path of the constructed files. If the described files cannot be written return a NULL pointer. */ output_path = construct_output_path (argv[remaining]); + if (output_path == NULL) + error (4, errno, _("cannot create directory for output files")); cannot_write_why = errno; /* Now that the parameters are processed we have to reset the local @@ -374,6 +376,9 @@ construct_output_path (char *path) output_prefix ?: "", LOCALEDIR, (int) (startp - path), path, normal, endp, '\0'); + if (n < 0) + return NULL; + endp = result + n - 1; } else @@ -392,7 +397,8 @@ construct_output_path (char *path) if (errno == ENOENT) { errno = 0; - mkdir (result, 0777); + if (mkdir (result, 0777) < 0) + return NULL; } *endp++ = '/'; -- cgit v1.2.3