Merge pull request #140784 from bjornfor/libredirect-handle-mkdir

libredirect: handle mkdir(2)
This commit is contained in:
Jörg Thalheim 2021-10-10 09:09:34 +01:00 committed by GitHub
commit 07ee93716c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -279,3 +279,17 @@ int system(const char *command)
rewriteSystemCall(command, newCommand);
return _system(newCommand);
}
int mkdir(const char *path, mode_t mode)
{
int (*mkdir_real) (const char *path, mode_t mode) = dlsym(RTLD_NEXT, "mkdir");
char buf[PATH_MAX];
return mkdir_real(rewrite(path, buf), mode);
}
int mkdirat(int dirfd, const char *path, mode_t mode)
{
int (*mkdirat_real) (int dirfd, const char *path, mode_t mode) = dlsym(RTLD_NEXT, "mkdirat");
char buf[PATH_MAX];
return mkdirat_real(dirfd, rewrite(path, buf), mode);
}