about summary refs log tree commit diff
path: root/locale/programs/localedef.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs/localedef.c')
-rw-r--r--locale/programs/localedef.c8
1 files changed, 7 insertions, 1 deletions
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++ = '/';