From 215c41710e842a892da23724d64c0f5414165496 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 6 Feb 2011 14:58:03 +0100 Subject: torture: Added torture_isdir(). --- tests/torture.c | 10 ++++++++++ tests/torture.h | 1 + 2 files changed, 11 insertions(+) diff --git a/tests/torture.c b/tests/torture.c index 7456cb6..983f1c3 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -128,6 +128,16 @@ int torture_rmdirs(const char *path) { return 0; } +int torture_isdir(const char *path) { + struct stat sb; + + if (lstat (path, &sb) == 0 && S_ISDIR(sb.st_mode)) { + return 1; + } + + return 0; +} + int torture_libssh_verbosity(void){ return verbosity; } diff --git a/tests/torture.h b/tests/torture.h index cc8abbc..e80d0e7 100644 --- a/tests/torture.h +++ b/tests/torture.h @@ -47,6 +47,7 @@ struct argument_s { void torture_cmdline_parse(int argc, char **argv, struct argument_s *arguments); int torture_rmdirs(const char *path); +int torture_isdir(const char *path); /* * Returns the verbosity level asked by user -- cgit