[CRIU] [PATCH] zdtm/tempfs: set mode for O_CREAT

Andrey Vagin avagin at openvz.org
Mon Sep 22 08:50:27 PDT 2014


man 2 open:
"""
mode specifies the permissions to use in case a new file is cre‐
ated.  This argument must be supplied when O_CREAT or O_TMPFILE
is specified in flags;
"""

Cc: Konstantin Neumoin <kneumoin at parallels.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/live/static/tempfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/live/static/tempfs.c b/test/zdtm/live/static/tempfs.c
index 3a6f449..b6b0bac 100644
--- a/test/zdtm/live/static/tempfs.c
+++ b/test/zdtm/live/static/tempfs.c
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
 	}
 
 	snprintf(fname, sizeof(buf), "%s/test.file", dirname);
-	fdo = open(fname, O_RDWR | O_CREAT);
+	fdo = open(fname, O_RDWR | O_CREAT, 0644);
 	if (fdo < 0) {
 		err("open failed");
 		goto err;
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
 	mkdir(overmount, 0700);
 
 	snprintf(fname, sizeof(buf), "%s/test.file", overmount);
-	fd = open(fname, O_RDWR | O_CREAT);
+	fd = open(fname, O_RDWR | O_CREAT, 0644);
 	if (fd < 0) {
 		err("open failed");
 		goto err;
-- 
1.9.3



More information about the CRIU mailing list