diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c index 664be40bc6b0ecdc5912e0b599c4b9ce885edbdd..944ae9c72b33a5347d73154fb26c0f8e0c996de8 100644 --- a/lustre/liblustre/tests/sanity.c +++ b/lustre/liblustre/tests/sanity.c @@ -146,7 +146,6 @@ static void pages_io(int xfer, loff_t pos) } } printf("succefully write %d pages(%d per xfer)\n", _npages, xfer); - memset(_buffer, 0, sizeof(_buffer)); /* read */ @@ -324,7 +323,7 @@ void t12() ENTRY("empty directory readdir"); t_mkdir(dir); - fd = t_open(dir); + fd = t_opendir(dir); t_ls(fd, buf, sizeof(buf)); t_close(fd); t_rmdir(dir); @@ -347,7 +346,7 @@ void t13() sprintf(name, "%s%s%05d", dir, prefix, i); t_touch(name); } - fd = t_open(dir); + fd = t_opendir(dir); t_ls(fd, buf, sizeof(buf)); t_close(fd); printf("Cleanup...\n"); @@ -375,7 +374,7 @@ void t14() sprintf(name, "%s%s%05d", dir, prefix, i); t_touch(name); } - fd = t_open(dir); + fd = t_opendir(dir); t_ls(fd, buf, sizeof(buf)); t_close(fd); printf("Cleanup...\n"); diff --git a/lustre/liblustre/tests/test_common.c b/lustre/liblustre/tests/test_common.c index 6f6676e9ed4044027310f282968151dc65480399..a87f0fa9ea022f5b340ca31d3a47b0dee924857a 100644 --- a/lustre/liblustre/tests/test_common.c +++ b/lustre/liblustre/tests/test_common.c @@ -181,6 +181,18 @@ int t_open(const char *path) return fd; } +int t_opendir(const char *path) +{ + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) { + printf("opendir(%s) error: %s\n", path, strerror(errno)); + EXIT_RET(fd); + } + return fd; +} + void t_close(int fd) { int rc; diff --git a/lustre/liblustre/tests/test_common.h b/lustre/liblustre/tests/test_common.h index 9d537cc69a6ae66a837530cc4b333fee5582effb..c3687b9edd9a3e73274f114b03fa668ff53e7eef 100644 --- a/lustre/liblustre/tests/test_common.h +++ b/lustre/liblustre/tests/test_common.h @@ -21,6 +21,7 @@ void t_chmod(const char *path, const char *format, ...); void t_rename(const char *oldpath, const char *newpath); int t_open_readonly(const char *path); int t_open(const char *path); +int t_opendir(const char *path); void t_close(int fd); int t_check_stat(const char *name, struct stat *buf); int t_check_stat_fail(const char *name);