fix: handle EINTR correctly in get_cpu_mask_from_sysfs
[urcu.git] / src / compat-smp.h
index 7240d2f66b3c8af059338df28bc032192abdcd20..5da8d6a03d7e7fd9b4b65e9617533c9b039bb436 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SPDX-License-Identifier: LGPL-2.1-only
+ * SPDX-License-Identifier: MIT
  *
  * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
@@ -36,6 +36,7 @@ static inline int get_num_possible_cpus_sysconf(void)
 }
 #endif
 
+#ifdef __linux__
 /*
  * Get the highest CPU id from sysfs.
  *
@@ -163,7 +164,7 @@ static inline int get_cpu_mask_from_sysfs(char *buf, size_t max_bytes, const cha
 
                total_bytes_read += bytes_read;
                assert(total_bytes_read <= max_bytes);
-       } while (max_bytes > total_bytes_read && bytes_read > 0);
+       } while (max_bytes > total_bytes_read && bytes_read != 0);
 
        /*
         * Make sure the mask read is a null terminated string.
@@ -235,7 +236,6 @@ error:
        return -1;
 }
 
-#ifdef __linux__
 /*
  * On Linux try sysfs first and fallback to sysconf.
  */
This page took 0.023666 seconds and 4 git commands to generate.