procd: detect lxc container and behave accordingly
[project/procd.git] / initd / zram.c
index b41bfd999ba2630f086cba140e5fdcd7aabfac6b..487d3d615f1d0b0eb9a28697383c2c89806868c0 100644 (file)
@@ -12,6 +12,7 @@
 #include <sys/stat.h>
 
 #include "../log.h"
+#include "../container.h"
 
 #include "init.h"
 
@@ -116,10 +117,12 @@ mount_zram_on_tmp(void)
                waitpid(pid, NULL, 0);
        }
 
-       ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | MS_NOATIME, "errors=continue,noquota");
-       if (ret < 0) {
-               ERROR("Can't mount /dev/zram0 on /tmp: %m\n");
-               return errno;
+       if (!is_container()) {
+               ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | MS_NOATIME, "errors=continue,noquota");
+               if (ret < 0) {
+                       ERROR("Can't mount /dev/zram0 on /tmp: %m\n");
+                       return errno;
+               }
        }
 
        LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize);