[systemd-devel] [PATCH 1/2] util: no need for in_initrd() cache to be thread-local

Shawn Landden shawn at churchofgit.com
Sun Dec 15 16:56:21 PST 2013


the process only has one working directory, and a race is
harmless
---
 src/shared/util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index b5ffaa1..7c73074 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2737,9 +2737,9 @@ int rm_rf_children_dangerous(int fd, bool only_dirs, bool honour_sticky, struct
 
 _pure_ static int is_temporary_fs(struct statfs *s) {
         assert(s);
-        return
-                F_TYPE_EQUAL(s->f_type, TMPFS_MAGIC) ||
-                F_TYPE_EQUAL(s->f_type, RAMFS_MAGIC);
+
+        return F_TYPE_EQUAL(s->f_type, TMPFS_MAGIC) ||
+               F_TYPE_EQUAL(s->f_type, RAMFS_MAGIC);
 }
 
 int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev) {
@@ -5155,7 +5155,7 @@ bool is_valid_documentation_url(const char *url) {
 }
 
 bool in_initrd(void) {
-        static __thread int saved = -1;
+        static int saved = -1;
         struct statfs s;
 
         if (saved >= 0)
-- 
1.8.5.1



More information about the systemd-devel mailing list