[CRIU] [PATCH 1/2] zdtm: check an unlinked file when a file with the save name exists
Andrey Vagin
avagin at openvz.org
Fri Nov 13 07:30:53 PST 2015
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/live/static/Makefile | 2 ++
test/zdtm/live/static/unlink_fstat01+.c | 1 +
test/zdtm/live/static/unlink_fstat01.c | 12 ++++++++++++
3 files changed, 15 insertions(+)
create mode 120000 test/zdtm/live/static/unlink_fstat01+.c
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index fd5a4f4..116daed 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -146,6 +146,7 @@ TST_FILE = \
deleted_dev \
unlink_fstat00 \
unlink_fstat01 \
+ unlink_fstat01+ \
unlink_fstat02 \
unlink_fstat03 \
unlink_largefile \
@@ -342,6 +343,7 @@ mntns_shared_bind02: override CFLAGS += -DSHARED_BIND02
maps02: get_smaps_bits.o
mlock_setuid: get_smaps_bits.o
inotify01: override CFLAGS += -DINOTIFY01
+unlink_fstat01+: override CFLAGS += -DUNLINK_OVER
$(LIB): force
$(Q) $(MAKE) -C $(LIBDIR)
diff --git a/test/zdtm/live/static/unlink_fstat01+.c b/test/zdtm/live/static/unlink_fstat01+.c
new file mode 120000
index 0000000..232e698
--- /dev/null
+++ b/test/zdtm/live/static/unlink_fstat01+.c
@@ -0,0 +1 @@
+unlink_fstat01.c
\ No newline at end of file
diff --git a/test/zdtm/live/static/unlink_fstat01.c b/test/zdtm/live/static/unlink_fstat01.c
index 7e03a2a..104abec 100644
--- a/test/zdtm/live/static/unlink_fstat01.c
+++ b/test/zdtm/live/static/unlink_fstat01.c
@@ -43,6 +43,18 @@ int main(int argc, char ** argv)
goto failed;
}
+#ifdef UNLINK_OVER
+{
+ int fdo;
+
+ fdo = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ if (fdo < 0) {
+ pr_perror("can't open %s", filename);
+ exit(1);
+ }
+}
+#endif
+
memset(buf, '0', sizeof(buf));
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
pr_perror("can't write %s", filename);
--
2.4.3
More information about the CRIU
mailing list