[CRIU] [PATCH 2/2] zdtm: check that file permissions are restored for unix sockets
Andrey Vagin
avagin at openvz.org
Tue Jan 29 06:25:37 EST 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/sockets00.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/test/zdtm/live/static/sockets00.c b/test/zdtm/live/static/sockets00.c
index 1ec5593..6ff93ab 100644
--- a/test/zdtm/live/static/sockets00.c
+++ b/test/zdtm/live/static/sockets00.c
@@ -24,12 +24,15 @@ const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org";
char *filename;
TEST_OPTION(filename, string, "socket file name", 1);
+#define TEST_MODE 0640
+
int main(int argc, char *argv[])
{
int ssk_icon[4];
struct sockaddr_un addr;
unsigned int addrlen;
+ struct stat st_b, st_a;
char path[PATH_MAX];
char buf[64];
char *cwd;
@@ -65,6 +68,12 @@ int main(int argc, char *argv[])
exit(1);
}
+ ret = chmod(path, TEST_MODE);
+ if (ret) {
+ err("chmod");
+ exit(1);
+ }
+
ret = listen(ssk_icon[0], 16);
if (ret) {
fail("bind\n");
@@ -89,9 +98,27 @@ int main(int argc, char *argv[])
exit(1);
}
+ ret = stat(path, &st_b);
+ if (ret) {
+ fail("stat");
+ exit(1);
+ }
+
test_daemon();
test_waitsig();
+ ret = stat(path, &st_a);
+ if (ret) {
+ fail("stat");
+ exit(1);
+ }
+
+ if (st_b.st_mode != st_a.st_mode) {
+ fail("The file permissions for %s were changed %o %o\n",
+ path, st_b.st_mode, st_a.st_mode);
+ exit(1);
+ }
+
ret = accept(ssk_icon[0], NULL, NULL);
if (ret < 0) {
fail("accept\n");
--
1.7.11.7
More information about the CRIU
mailing list