We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3197d77 commit ca13432Copy full SHA for ca13432
src/basic/locale-util.c
@@ -17,6 +17,7 @@
17
#include "fileio.h"
18
#include "hashmap.h"
19
#include "locale-util.h"
20
+#include "missing_syscall.h"
21
#include "path-util.h"
22
#include "set.h"
23
#include "string-table.h"
@@ -303,6 +304,12 @@ bool is_locale_utf8(void) {
303
304
} else if (r != -ENXIO)
305
log_debug_errno(r, "Failed to parse $SYSTEMD_UTF8, ignoring: %m");
306
307
+ /* This function may be called from libsystemd, and setlocale() is not thread safe. Assuming yes. */
308
+ if (gettid() != raw_getpid()) {
309
+ cached_answer = true;
310
+ goto out;
311
+ }
312
+
313
if (!setlocale(LC_ALL, "")) {
314
cached_answer = true;
315
goto out;
0 commit comments