chiark / gitweb /
util: an array with one entry is always ordered
[elogind.git] / src / shared / util.h
index 4cea627580fd86586acdb5bee5f966e3dde32b0a..3aef47f37d36accaa38ed8e883fe514e62afc8ca 100644 (file)
@@ -775,7 +775,7 @@ int shall_restore_state(void);
  * that only if nmemb > 0.
  */
 static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) {
-        if (nmemb <= 0)
+        if (nmemb <= 1)
                 return;
 
         assert(base);
@@ -816,6 +816,13 @@ int open_tmpfile(const char *path, int flags);
 
 int fd_warn_permissions(const char *path, int fd);
 
+#ifndef PERSONALITY_INVALID
+/* personality(7) documents that 0xffffffffUL is used for querying the
+ * current personality, hence let's use that here as error
+ * indicator. */
+#define PERSONALITY_INVALID 0xffffffffLU
+#endif
+
 unsigned long personality_from_string(const char *p);
 const char *personality_to_string(unsigned long);
 
@@ -906,3 +913,5 @@ char *shell_maybe_quote(const char *s);
 int parse_mode(const char *s, mode_t *ret);
 
 int mount_move_root(const char *path);
+
+int reset_uid_gid(void);