AI Update: [User uploaded file copykar.zip (28.27 MB) via Web Uploade
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/stat.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
/*
|
||||
* Docker Desktop Linux / macOS host-bind-mount permissions compatibility shim.
|
||||
* Masks directory permissions to satisfy PostgreSQL checkDataDir() (0700 requirement).
|
||||
*/
|
||||
|
||||
int (*real_stat)(const char *path, struct stat *buf);
|
||||
int stat(const char *path, struct stat *buf) {
|
||||
if (!real_stat) real_stat = dlsym(RTLD_NEXT, "stat");
|
||||
int res = real_stat(path, buf);
|
||||
if (res == 0 && S_ISDIR(buf->st_mode)) {
|
||||
buf->st_mode &= ~(S_IRWXG | S_IRWXO);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int (*real_fstatat)(int dirfd, const char *pathname, struct stat *buf, int flags);
|
||||
int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags) {
|
||||
if (!real_fstatat) real_fstatat = dlsym(RTLD_NEXT, "fstatat");
|
||||
int res = real_fstatat(dirfd, pathname, buf, flags);
|
||||
if (res == 0 && S_ISDIR(buf->st_mode)) {
|
||||
buf->st_mode &= ~(S_IRWXG | S_IRWXO);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int (*real_lstat)(const char *path, struct stat *buf);
|
||||
int lstat(const char *path, struct stat *buf) {
|
||||
if (!real_lstat) real_lstat = dlsym(RTLD_NEXT, "lstat");
|
||||
int res = real_lstat(path, buf);
|
||||
if (res == 0 && S_ISDIR(buf->st_mode)) {
|
||||
buf->st_mode &= ~(S_IRWXG | S_IRWXO);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user