mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 21:07:43 +00:00
zdtm/memfd00: test memfd file mode
Signed-off-by: Michał Mirosław <emmir@google.com>
This commit is contained in:
parent
dfa5410951
commit
3628589b51
@ -30,8 +30,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int fd, fl_flags1, fl_flags2, fd_flags1, fd_flags2;
|
||||
struct statfs statfs1, statfs2;
|
||||
struct stat stat;
|
||||
off_t pos1, pos2;
|
||||
char buf[5];
|
||||
int fmode1, fmode2;
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
@ -58,6 +60,13 @@ int main(int argc, char *argv[])
|
||||
if (lseek(fd, pos1, SEEK_SET) < 0)
|
||||
err(1, "seek error");
|
||||
|
||||
if (fchmod(fd, 0642))
|
||||
err(1, "Can't set permission bits");
|
||||
|
||||
if (fstat(fd, &stat) < 0)
|
||||
err(1, "fstat() issue");
|
||||
fmode1 = stat.st_mode;
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
@ -85,6 +94,15 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fstat(fd, &stat) < 0)
|
||||
err(1, "fstat() issue");
|
||||
fmode2 = stat.st_mode;
|
||||
|
||||
if (fmode1 != fmode2) {
|
||||
fail("stat.st_mode = %#o != %#o", fmode2, fmode1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pos2 = lseek(fd, 0, SEEK_CUR);
|
||||
if (pos1 != pos2) {
|
||||
fail("position differs");
|
||||
|
Loading…
x
Reference in New Issue
Block a user