mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
zdtm: check that file permissions are restored for unix sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
f3cd454cd4
commit
ccbbb18ae2
@@ -24,12 +24,15 @@ const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org";
|
|||||||
char *filename;
|
char *filename;
|
||||||
TEST_OPTION(filename, string, "socket file name", 1);
|
TEST_OPTION(filename, string, "socket file name", 1);
|
||||||
|
|
||||||
|
#define TEST_MODE 0640
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ssk_icon[4];
|
int ssk_icon[4];
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
unsigned int addrlen;
|
unsigned int addrlen;
|
||||||
|
|
||||||
|
struct stat st_b, st_a;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char *cwd;
|
char *cwd;
|
||||||
@@ -65,6 +68,12 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = chmod(path, TEST_MODE);
|
||||||
|
if (ret) {
|
||||||
|
err("chmod");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
ret = listen(ssk_icon[0], 16);
|
ret = listen(ssk_icon[0], 16);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fail("bind\n");
|
fail("bind\n");
|
||||||
@@ -89,9 +98,27 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = stat(path, &st_b);
|
||||||
|
if (ret) {
|
||||||
|
fail("stat");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
test_daemon();
|
test_daemon();
|
||||||
test_waitsig();
|
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);
|
ret = accept(ssk_icon[0], NULL, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fail("accept\n");
|
fail("accept\n");
|
||||||
|
Reference in New Issue
Block a user