about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-16 14:10:36 +0100
committerPetr Baudis <pasky@ucw.cz>2011-05-27 01:39:26 +0200
commit50cb4b00a29d36d99bb36be9b15c78ef5da14305 (patch)
treedc5415b66ceb6d21f7f573b68d25d957fda636f9
parent54717475a5f7d0ecc25dfb0cf51d9cf43d4ff8f8 (diff)
downloadglibc-50cb4b00a29d36d99bb36be9b15c78ef5da14305.tar.gz
glibc-50cb4b00a29d36d99bb36be9b15c78ef5da14305.tar.xz
glibc-50cb4b00a29d36d99bb36be9b15c78ef5da14305.zip
Fix test for error_one_per_line mode in error
(cherry picked from commit 15cc7dd182a6be79cbb01a5de4f13e958717bd69)
-rw-r--r--ChangeLog5
-rw-r--r--misc/error.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0609c9183a..1dbb176755 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-05-16  Ulrich Drepper  <drepper@gmail.com>
 
+	[BZ #12766]
+	* misc/error.c (error_at_line): Ensure file_name and old_file_name
+	point to strings before performing equality test for error_one_per_line
+	mode.
+
 	[BZ #11697]
 	* login/programs/pt_chown.c (do_pt_chown): Always call chown.
 
diff --git a/misc/error.c b/misc/error.c
index 85d1cffbf9..9a73a61c74 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -272,7 +272,9 @@ error_at_line (int status, int errnum, const char *file_name,
 
       if (old_line_number == line_number
 	  && (file_name == old_file_name
-	      || strcmp (old_file_name, file_name) == 0))
+	      || (old_file_name != NULL
+		  && file_name != NULL
+		  && strcmp (old_file_name, file_name) == 0)))
 	/* Simply return and print nothing.  */
 	return;