This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch release/2.15/master updated. glibc-2.15-54-ge8b5394
- From: carlos at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 30 Jan 2014 07:20:24 -0000
- Subject: GNU C Library master sources branch release/2.15/master updated. glibc-2.15-54-ge8b5394
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, release/2.15/master has been updated
via e8b5394afb420449dde0b4cbefd4032936d96a25 (commit)
from 4a659bb814338f2fd33937a3b0aeff28af28c4e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e8b5394afb420449dde0b4cbefd4032936d96a25
commit e8b5394afb420449dde0b4cbefd4032936d96a25
Author: Ulrich Drepper <drepper@gmail.com>
Date: Fri Feb 24 21:18:04 2012 -0500
Fix locking in fmtmsg
(cherry picked from commit 7724defcf8873116fe4efab256596861eef21a94)
diff --git a/ChangeLog b/ChangeLog
index edda876..9654d0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-24 Ulrich Drepper <drepper@gmail.com>
+
+ * stdlib/fmtmsg.c (fmtmsg): Lock around use of severity list.
+ Reported by Peng Haitao <penght@cn.fujitsu.com>.
+
2012-01-27 Ulrich Drepper <drepper@gmail.com>
[BZ #13618]
diff --git a/NEWS b/NEWS
index 48a9823..63cf1d1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,8 +10,8 @@ Version 2.15.1
* The following bugs are resolved with this release:
411, 2547, 2548, 11261, 11365, 11494, 13583, 13618, 13731, 13732, 13733,
- 13747, 13748, 13749, 13753, 13754, 13756, 13771, 13773, 13774, 13786,
- 14048, 14059, 14167, 14273, 14459, 14621, 14648, 14040, 15073
+ 13747, 13748, 13749, 13753, 13754, 13756, 13765, 13771, 13773, 13774,
+ 13786, 14048, 14059, 14167, 14273, 14459, 14621, 14648, 14040, 15073
Version 2.15
diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
index 8ee06bf..47e409f 100644
--- a/stdlib/fmtmsg.c
+++ b/stdlib/fmtmsg.c
@@ -103,7 +103,6 @@ fmtmsg (long int classification, const char *label, int severity,
const char *text, const char *action, const char *tag)
{
__libc_once_define (static, once);
- int result = MM_OK;
struct severity_info *severity_rec;
/* Make sure everything is initialized. */
@@ -124,17 +123,6 @@ fmtmsg (long int classification, const char *label, int severity,
return MM_NOTOK;
}
- for (severity_rec = severity_list; severity_rec != NULL;
- severity_rec = severity_rec->next)
- if (severity == severity_rec->severity)
- /* Bingo. */
- break;
-
- /* If we don't know anything about the severity level return an error. */
- if (severity_rec == NULL)
- return MM_NOTOK;
-
-
#ifdef __libc_ptf_call
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
@@ -143,54 +131,73 @@ fmtmsg (long int classification, const char *label, int severity,
0);
#endif
- /* Now we can print. */
- if (classification & MM_PRINT)
- {
- int do_label = (print & label_mask) && label != MM_NULLLBL;
- int do_severity = (print & severity_mask) && severity != MM_NULLSEV;
- int do_text = (print & text_mask) && text != MM_NULLTXT;
- int do_action = (print & action_mask) && action != MM_NULLACT;
- int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
-
- if (__fxprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
- do_label ? label : "",
- do_label && (do_severity | do_text | do_action | do_tag)
- ? ": " : "",
- do_severity ? severity_rec->string : "",
- do_severity && (do_text | do_action | do_tag)
- ? ": " : "",
- do_text ? text : "",
- do_text && (do_action | do_tag) ? "\n" : "",
- do_action ? "TO FIX: " : "",
- do_action ? action : "",
- do_action && do_tag ? " " : "",
- do_tag ? tag : "") < 0)
- /* Oh, oh. An error occurred during the output. */
- result = MM_NOMSG;
- }
+ __libc_lock_lock (lock);
- if (classification & MM_CONSOLE)
+ for (severity_rec = severity_list; severity_rec != NULL;
+ severity_rec = severity_rec->next)
+ if (severity == severity_rec->severity)
+ /* Bingo. */
+ break;
+
+ /* If we don't know anything about the severity level return an error. */
+ int result = MM_NOTOK;
+ if (severity_rec != NULL)
{
- int do_label = label != MM_NULLLBL;
- int do_severity = severity != MM_NULLSEV;
- int do_text = text != MM_NULLTXT;
- int do_action = action != MM_NULLACT;
- int do_tag = tag != MM_NULLTAG;
-
- syslog (LOG_ERR, "%s%s%s%s%s%s%s%s%s%s\n",
- do_label ? label : "",
- do_label && (do_severity | do_text | do_action | do_tag)
- ? ": " : "",
- do_severity ? severity_rec->string : "",
- do_severity && (do_text | do_action | do_tag) ? ": " : "",
- do_text ? text : "",
- do_text && (do_action | do_tag) ? "\n" : "",
- do_action ? "TO FIX: " : "",
- do_action ? action : "",
- do_action && do_tag ? " " : "",
- do_tag ? tag : "");
+ result = MM_OK;
+
+ /* Now we can print. */
+ if (classification & MM_PRINT)
+ {
+ int do_label = (print & label_mask) && label != MM_NULLLBL;
+ int do_severity = (print & severity_mask) && severity != MM_NULLSEV;
+ int do_text = (print & text_mask) && text != MM_NULLTXT;
+ int do_action = (print & action_mask) && action != MM_NULLACT;
+ int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
+ int need_colon = (do_label
+ && (do_severity | do_text | do_action | do_tag));
+
+ if (__fxprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
+ do_label ? label : "",
+ need_colon ? ": " : "",
+ do_severity ? severity_rec->string : "",
+ do_severity && (do_text | do_action | do_tag)
+ ? ": " : "",
+ do_text ? text : "",
+ do_text && (do_action | do_tag) ? "\n" : "",
+ do_action ? "TO FIX: " : "",
+ do_action ? action : "",
+ do_action && do_tag ? " " : "",
+ do_tag ? tag : "") < 0)
+ /* Oh, oh. An error occurred during the output. */
+ result = MM_NOMSG;
+ }
+
+ if (classification & MM_CONSOLE)
+ {
+ int do_label = label != MM_NULLLBL;
+ int do_severity = severity != MM_NULLSEV;
+ int do_text = text != MM_NULLTXT;
+ int do_action = action != MM_NULLACT;
+ int do_tag = tag != MM_NULLTAG;
+ int need_colon = (do_label
+ && (do_severity | do_text | do_action | do_tag));
+
+ syslog (LOG_ERR, "%s%s%s%s%s%s%s%s%s%s\n",
+ do_label ? label : "",
+ need_colon ? ": " : "",
+ do_severity ? severity_rec->string : "",
+ do_severity && (do_text | do_action | do_tag) ? ": " : "",
+ do_text ? text : "",
+ do_text && (do_action | do_tag) ? "\n" : "",
+ do_action ? "TO FIX: " : "",
+ do_action ? action : "",
+ do_action && do_tag ? " " : "",
+ do_tag ? tag : "");
+ }
}
+ __libc_lock_unlock (lock);
+
#ifdef __libc_ptf_call
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
#endif
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 ++
NEWS | 4 +-
stdlib/fmtmsg.c | 119 +++++++++++++++++++++++++++++--------------------------
3 files changed, 70 insertions(+), 58 deletions(-)
hooks/post-receive
--
GNU C Library master sources