aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2012-05-24 01:58:54 -0300
committerLucas De Marchi <lucas.de.marchi@gmail.com>2012-06-05 00:54:47 -0300
commit113d0084d4c44e219a055b358b166c32663863d3 (patch)
tree280dbd3a650ee1d2ff1cc3994a832cd2e4c75eef
parent0de690c96c15bdbe2ea04e81092b14dc8b3cfd86 (diff)
downloadkmod-113d0084d4c44e219a055b358b166c32663863d3.tar.gz
testsuite: trap calls to mkdir
-rw-r--r--testsuite/path.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/path.c b/testsuite/path.c
index 60df4a0..204c79f 100644
--- a/testsuite/path.c
+++ b/testsuite/path.c
@@ -139,6 +139,23 @@ TS_EXPORT int open(const char *path, int flags, ...)
return _open(p, flags);
}
+TS_EXPORT int mkdir(const char *path, mode_t mode)
+{
+ const char *p;
+ char buf[PATH_MAX * 2];
+ static int (*_mkdir)(const char *path, mode_t mode);
+
+ if (!get_rootpath(__func__))
+ return -1;
+
+ _mkdir = get_libc_func("mkdir");
+ p = trap_path(path, buf);
+ if (p == NULL)
+ return -1;
+
+ return _mkdir(p, mode);
+}
+
TS_EXPORT int stat(const char *path, struct stat *st)
{
const char *p;