Commit 0b4fecca authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

zdtm: check an unlinked file when a file with the save name exists

Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 138d2631
...@@ -146,6 +146,7 @@ TST_FILE = \ ...@@ -146,6 +146,7 @@ TST_FILE = \
deleted_dev \ deleted_dev \
unlink_fstat00 \ unlink_fstat00 \
unlink_fstat01 \ unlink_fstat01 \
unlink_fstat01+ \
unlink_fstat02 \ unlink_fstat02 \
unlink_fstat03 \ unlink_fstat03 \
unlink_largefile \ unlink_largefile \
...@@ -342,6 +343,7 @@ mntns_shared_bind02: override CFLAGS += -DSHARED_BIND02 ...@@ -342,6 +343,7 @@ mntns_shared_bind02: override CFLAGS += -DSHARED_BIND02
maps02: get_smaps_bits.o maps02: get_smaps_bits.o
mlock_setuid: get_smaps_bits.o mlock_setuid: get_smaps_bits.o
inotify01: override CFLAGS += -DINOTIFY01 inotify01: override CFLAGS += -DINOTIFY01
unlink_fstat01+: override CFLAGS += -DUNLINK_OVER
$(LIB): force $(LIB): force
$(Q) $(MAKE) -C $(LIBDIR) $(Q) $(MAKE) -C $(LIBDIR)
......
unlink_fstat01.c
\ No newline at end of file
...@@ -43,6 +43,18 @@ int main(int argc, char ** argv) ...@@ -43,6 +43,18 @@ int main(int argc, char ** argv)
goto failed; 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)); memset(buf, '0', sizeof(buf));
if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
pr_perror("can't write %s", filename); pr_perror("can't write %s", filename);
......
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