]> git.proxmox.com Git - mirror_lxc.git/commitdiff
conf.c: Cleanup __S_ISTYPE
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 3 Jan 2013 17:24:20 +0000 (12:24 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 9 Jan 2013 15:22:54 +0000 (10:22 -0500)
__S_ISTYPE doesn't exist in all C libraries, so define it if it's missing.
Additionaly, replace one occurence where it wasn't actually needed.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 062434f92a60265ad4a6fea3d9f224c468eed964..eb4f8bd230fcbc96afb9b62484db7ef9a47eee76 100644 (file)
@@ -166,6 +166,11 @@ return -1;
 }
 #endif
 
+/* Define __S_ISTYPE if missing from the C library */
+#ifndef __S_ISTYPE
+#define        __S_ISTYPE(mode, mask)  (((mode) & S_IFMT) == (mask))
+#endif
+
 char *lxchook_names[NUM_LXC_HOOKS] = {
        "pre-start", "pre-mount", "mount", "start", "post-stop" };
 
@@ -590,7 +595,7 @@ int pin_rootfs(const char *rootfs)
                return -1;
        }
 
-       if (!__S_ISTYPE(s.st_mode, S_IFDIR))
+       if (!S_ISDIR(s.st_mode))
                return -2;
 
        ret = snprintf(absrootfspin, MAXPATHLEN, "%s%s", absrootfs, ".hold");