Commit 4a6b286c authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

test: rmdir_open -- Delete two levels of directories

One level always been handled properly but
two levels may cause problems.

travis-ci: success for Multiple nested deleted dentries fix
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 994d5987
......@@ -4,6 +4,7 @@
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include "zdtmtst.h"
......@@ -15,23 +16,25 @@ TEST_OPTION(dirname, string, "directory name", 1);
int main(int argc, char **argv)
{
char subdir[PATH_MAX];
int fd;
struct stat st;
test_init(argc, argv);
if (mkdir(dirname, 0700)) {
sprintf(subdir, "%s/subdir", dirname);
if (mkdir(dirname, 0700) || mkdir(subdir, 0700)) {
pr_perror("Can't make dir");
goto out;
}
fd = open(dirname, O_DIRECTORY);
fd = open(subdir, O_DIRECTORY);
if (fd < 0) {
pr_perror("Can't open dir");
goto outr;
}
if (rmdir(dirname)) {
if (rmdir(subdir) || rmdir(dirname)) {
pr_perror("Can't remove dir");
goto outr;
}
......
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