[CRIU] [PATCH] test/zdtm/mountpoints: clear the umask when creating /dev/null
Yicheng Qin
yichengq at google.com
Fri Aug 2 19:30:12 EDT 2013
From: Yicheng Qin <yichengq at google.com>
Subject: [PATCH] test/zdtm/mountpoints: clear the umask when creating
/dev/null
Clear the umask when creating /dev/null and restore the umask
after the creation.
Mountpoints test unlinks and makes new /dev/null inside by mknod.
But in some linux, there is default umask, e.g., as 022. It means that
/dev/null created directly cannot be wrote by group and other users.
It is not reasonable because /dev/null should be accessable to all
users.
Signed-off-by: Yicheng Qin <yichengq at google.com>
---
test/zdtm/live/static/mountpoints.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/test/zdtm/live/static/mountpoints.c
b/test/zdtm/live/static/mountpoints.c
index dde9de8..a1f8dea 100644
--- a/test/zdtm/live/static/mountpoints.c
+++ b/test/zdtm/live/static/mountpoints.c
@@ -20,6 +20,7 @@ static int test_fn(int argc, char **argv)
int fd, tmpfs_fd;
unsigned fs_cnt, fs_cnt_last = 0;
bool private = false;
+ mode_t old_mask;
again:
fs_cnt = 0;
@@ -108,7 +109,15 @@ done:
}
unlink("/dev/null");
+ /*
+ * Clear umask first, create readable & writeable /dev/null,
+ * and change it back. This is done to ensure that file mode
+ * creation mask will not impede it to create file that grants
+ * read and write permission to all users.
+ */
+ old_mask = umask(0);
mknod("/dev/null", 0777 | S_IFCHR, makedev(1, 3));
+ umask(old_mask);
setup_outfile();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20130802/b495d04f/attachment.html>
More information about the CRIU
mailing list