Magellan Linux

Contents of /trunk/glibc/patches/glibc-2.15-fmtmsg-locking.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1806 - (show annotations) (download)
Tue Jun 12 12:33:27 2012 UTC (11 years, 10 months ago) by niro
File size: 5179 byte(s)
-added patches for 2.15-r1
1 diff --git a/stdlib/fmtmsg.c b/stdlib/fmtmsg.c
2 index 9203317..4c02302 100644
3 --- a/stdlib/fmtmsg.c
4 +++ b/stdlib/fmtmsg.c
5 @@ -103,7 +103,6 @@ fmtmsg (long int classification, const char *label, int severity,
6 const char *text, const char *action, const char *tag)
7 {
8 __libc_once_define (static, once);
9 - int result = MM_OK;
10 struct severity_info *severity_rec;
11
12 /* Make sure everything is initialized. */
13 @@ -124,17 +123,6 @@ fmtmsg (long int classification, const char *label, int severity,
14 return MM_NOTOK;
15 }
16
17 - for (severity_rec = severity_list; severity_rec != NULL;
18 - severity_rec = severity_rec->next)
19 - if (severity == severity_rec->severity)
20 - /* Bingo. */
21 - break;
22 -
23 - /* If we don't know anything about the severity level return an error. */
24 - if (severity_rec == NULL)
25 - return MM_NOTOK;
26 -
27 -
28 #ifdef __libc_ptf_call
29 /* We do not want this call to be cut short by a thread
30 cancellation. Therefore disable cancellation for now. */
31 @@ -143,54 +131,73 @@ fmtmsg (long int classification, const char *label, int severity,
32 0);
33 #endif
34
35 - /* Now we can print. */
36 - if (classification & MM_PRINT)
37 - {
38 - int do_label = (print & label_mask) && label != MM_NULLLBL;
39 - int do_severity = (print & severity_mask) && severity != MM_NULLSEV;
40 - int do_text = (print & text_mask) && text != MM_NULLTXT;
41 - int do_action = (print & action_mask) && action != MM_NULLACT;
42 - int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
43 -
44 - if (__fxprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
45 - do_label ? label : "",
46 - do_label && (do_severity | do_text | do_action | do_tag)
47 - ? ": " : "",
48 - do_severity ? severity_rec->string : "",
49 - do_severity && (do_text | do_action | do_tag)
50 - ? ": " : "",
51 - do_text ? text : "",
52 - do_text && (do_action | do_tag) ? "\n" : "",
53 - do_action ? "TO FIX: " : "",
54 - do_action ? action : "",
55 - do_action && do_tag ? " " : "",
56 - do_tag ? tag : "") < 0)
57 - /* Oh, oh. An error occurred during the output. */
58 - result = MM_NOMSG;
59 - }
60 + __libc_lock_lock (lock);
61
62 - if (classification & MM_CONSOLE)
63 + for (severity_rec = severity_list; severity_rec != NULL;
64 + severity_rec = severity_rec->next)
65 + if (severity == severity_rec->severity)
66 + /* Bingo. */
67 + break;
68 +
69 + /* If we don't know anything about the severity level return an error. */
70 + int result = MM_NOTOK;
71 + if (severity_rec != NULL)
72 {
73 - int do_label = label != MM_NULLLBL;
74 - int do_severity = severity != MM_NULLSEV;
75 - int do_text = text != MM_NULLTXT;
76 - int do_action = action != MM_NULLACT;
77 - int do_tag = tag != MM_NULLTAG;
78 -
79 - syslog (LOG_ERR, "%s%s%s%s%s%s%s%s%s%s\n",
80 - do_label ? label : "",
81 - do_label && (do_severity | do_text | do_action | do_tag)
82 - ? ": " : "",
83 - do_severity ? severity_rec->string : "",
84 - do_severity && (do_text | do_action | do_tag) ? ": " : "",
85 - do_text ? text : "",
86 - do_text && (do_action | do_tag) ? "\n" : "",
87 - do_action ? "TO FIX: " : "",
88 - do_action ? action : "",
89 - do_action && do_tag ? " " : "",
90 - do_tag ? tag : "");
91 + result = MM_OK;
92 +
93 + /* Now we can print. */
94 + if (classification & MM_PRINT)
95 + {
96 + int do_label = (print & label_mask) && label != MM_NULLLBL;
97 + int do_severity = (print & severity_mask) && severity != MM_NULLSEV;
98 + int do_text = (print & text_mask) && text != MM_NULLTXT;
99 + int do_action = (print & action_mask) && action != MM_NULLACT;
100 + int do_tag = (print & tag_mask) && tag != MM_NULLTAG;
101 + int need_colon = (do_label
102 + && (do_severity | do_text | do_action | do_tag));
103 +
104 + if (__fxprintf (stderr, "%s%s%s%s%s%s%s%s%s%s\n",
105 + do_label ? label : "",
106 + need_colon ? ": " : "",
107 + do_severity ? severity_rec->string : "",
108 + do_severity && (do_text | do_action | do_tag)
109 + ? ": " : "",
110 + do_text ? text : "",
111 + do_text && (do_action | do_tag) ? "\n" : "",
112 + do_action ? "TO FIX: " : "",
113 + do_action ? action : "",
114 + do_action && do_tag ? " " : "",
115 + do_tag ? tag : "") < 0)
116 + /* Oh, oh. An error occurred during the output. */
117 + result = MM_NOMSG;
118 + }
119 +
120 + if (classification & MM_CONSOLE)
121 + {
122 + int do_label = label != MM_NULLLBL;
123 + int do_severity = severity != MM_NULLSEV;
124 + int do_text = text != MM_NULLTXT;
125 + int do_action = action != MM_NULLACT;
126 + int do_tag = tag != MM_NULLTAG;
127 + int need_colon = (do_label
128 + && (do_severity | do_text | do_action | do_tag));
129 +
130 + syslog (LOG_ERR, "%s%s%s%s%s%s%s%s%s%s\n",
131 + do_label ? label : "",
132 + need_colon ? ": " : "",
133 + do_severity ? severity_rec->string : "",
134 + do_severity && (do_text | do_action | do_tag) ? ": " : "",
135 + do_text ? text : "",
136 + do_text && (do_action | do_tag) ? "\n" : "",
137 + do_action ? "TO FIX: " : "",
138 + do_action ? action : "",
139 + do_action && do_tag ? " " : "",
140 + do_tag ? tag : "");
141 + }
142 }
143
144 + __libc_lock_unlock (lock);
145 +
146 #ifdef __libc_ptf_call
147 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
148 #endif