summaryrefslogtreecommitdiff
path: root/src/systemd/src/basic/string-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemd/src/basic/string-util.c')
-rw-r--r--src/systemd/src/basic/string-util.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/systemd/src/basic/string-util.c b/src/systemd/src/basic/string-util.c
index e916000b25..7e2f596edc 100644
--- a/src/systemd/src/basic/string-util.c
+++ b/src/systemd/src/basic/string-util.c
@@ -22,6 +22,7 @@
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
@@ -669,10 +670,10 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz) {
if (!f)
return NULL;
- /* Note we use the _unlocked() stdio variants on f for performance
- * reasons. It's safe to do so since we created f here and it
- * doesn't leave our scope.
- */
+ /* Note we turn off internal locking on f for performance reasons. It's safe to do so since we created f here
+ * and it doesn't leave our scope. */
+
+ (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
for (i = *ibuf; i < *ibuf + isz + 1; i++) {
@@ -684,21 +685,21 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz) {
else if (*i == '\x1B')
state = STATE_ESCAPE;
else if (*i == '\t')
- fputs_unlocked(" ", f);
+ fputs(" ", f);
else
- fputc_unlocked(*i, f);
+ fputc(*i, f);
break;
case STATE_ESCAPE:
if (i >= *ibuf + isz) { /* EOT */
- fputc_unlocked('\x1B', f);
+ fputc('\x1B', f);
break;
} else if (*i == '[') {
state = STATE_BRACKET;
begin = i + 1;
} else {
- fputc_unlocked('\x1B', f);
- fputc_unlocked(*i, f);
+ fputc('\x1B', f);
+ fputc(*i, f);
state = STATE_OTHER;
}
@@ -708,8 +709,8 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz) {
if (i >= *ibuf + isz || /* EOT */
(!(*i >= '0' && *i <= '9') && !IN_SET(*i, ';', 'm'))) {
- fputc_unlocked('\x1B', f);
- fputc_unlocked('[', f);
+ fputc('\x1B', f);
+ fputc('[', f);
state = STATE_OTHER;
i = begin-1;
} else if (*i == 'm')