chiark / gitweb /
pam: do not leak file descriptor if flock fails
[elogind.git] / src / util.c
index 96cf6605f3c5f8b2335c03517ecbaa0b9c8832ac..c02b39e0ad5fb896d1c80977328b9762b2678e3c 100644 (file)
@@ -3820,8 +3820,7 @@ int detect_vm(const char **id) {
                 "Microsoft Corporation\0" "microsoft\0"
                 "innotek GmbH\0"          "oracle\0"
                 "Xen\0"                   "xen\0"
-                "Bochs\0"                 "bochs\0"
-                "\0";
+                "Bochs\0"                 "bochs\0";
 
         static const char cpuid_vendor_table[] =
                 "XenVMMXenVMM\0"          "xen\0"
@@ -3829,8 +3828,7 @@ int detect_vm(const char **id) {
                 /* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
                 "VMwareVMware\0"          "vmware\0"
                 /* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
-                "Microsoft Hv\0"          "microsoft\0"
-                "\0";
+                "Microsoft Hv\0"          "microsoft\0";
 
         uint32_t eax, ecx;
         union {
@@ -4081,6 +4079,19 @@ int kill_and_sigcont(pid_t pid, int sig) {
         return r;
 }
 
+bool nulstr_contains(const char*nulstr, const char *needle) {
+        const char *i;
+
+        if (!nulstr)
+                return false;
+
+        NULSTR_FOREACH(i, nulstr)
+                if (streq(i, needle))
+                        return true;
+
+        return false;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",