Commit d9df71dc authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Extend inotify00 test to have ghost file used

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b146fe4a
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
const char *test_doc = "Check for inotify delivery"; const char *test_doc = "Check for inotify delivery";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>"; const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
const char path[] = "inotify-removed";
#define BUFF_SIZE ((sizeof(struct inotify_event) + PATH_MAX)) #define BUFF_SIZE ((sizeof(struct inotify_event) + PATH_MAX))
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
char buf[BUFF_SIZE]; char buf[BUFF_SIZE];
int fd, wd; int fd, wd, deleted, wd_deleted;
test_init(argc, argv); test_init(argc, argv);
...@@ -40,6 +42,23 @@ int main (int argc, char *argv[]) ...@@ -40,6 +42,23 @@ int main (int argc, char *argv[])
exit(1); exit(1);
} }
deleted = open(path, O_CREAT | O_TRUNC);
if (deleted < 0) {
fail("inotify_init failed");
exit(1);
}
wd_deleted = inotify_add_watch(fd, path, IN_ALL_EVENTS);
if (wd_deleted < 0) {
fail("inotify_add_watch failed");
exit(1);
}
if (unlink(path)) {
fail("can't unlink %s\n", path);
exit(1);
}
test_daemon(); test_daemon();
test_waitsig(); test_waitsig();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment