]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: trap calls to mkdir
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 24 May 2012 04:58:54 +0000 (01:58 -0300)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 5 Jun 2012 03:54:47 +0000 (00:54 -0300)
testsuite/path.c

index 60df4a02cfddf016b57806b812c7610b05425e01..204c79f9a6c1f49ce0f89fa4f31a3722dad5b803 100644 (file)
@@ -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;