summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-06 08:49:08 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-06 08:49:08 +0000
commit383bd1c5033b466ffcc1a0be766d8a8b003c73e9 (patch)
tree06aec2446da55eee38518fb8296728d0910f258d /locale
parent1e06620a7b9c6c65284c52b4625eabd23b14c77c (diff)
downloadglibc-383bd1c5033b466ffcc1a0be766d8a8b003c73e9.tar.gz
glibc-383bd1c5033b466ffcc1a0be766d8a8b003c73e9.tar.xz
glibc-383bd1c5033b466ffcc1a0be766d8a8b003c73e9.zip
Update.
2001-12-06  Ulrich Drepper  <drepper@redhat.com>

	* 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 <ldv@alt-linux.org>.
Diffstat (limited to 'locale')
-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++ = '/';