aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-02-06 14:58:03 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-02-06 15:35:18 +0100
commit215c41710e842a892da23724d64c0f5414165496 (patch)
tree292606429787d90ca0388f27c28d17dc55a1b95a
parent97d261dc791a3b5e4b30bf384fd8a73da90d2372 (diff)
downloadlibssh-215c41710e842a892da23724d64c0f5414165496.tar.gz
libssh-215c41710e842a892da23724d64c0f5414165496.tar.xz
libssh-215c41710e842a892da23724d64c0f5414165496.zip
torture: Added torture_isdir().
-rw-r--r--tests/torture.c10
-rw-r--r--tests/torture.h1
2 files changed, 11 insertions, 0 deletions
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