revert the workaround for the usage of private/hidden glibc exports on linux, and fix it by directly calling the corresponding functions without the ver parameter: stat, lstat, stat64, lstat64, mknod.

might break stuff!
reverts 3b6663ca99
This commit is contained in:
otavepto 2024-03-01 12:50:58 +02:00
parent f7fdfba6df
commit 2cbc786430
2 changed files with 5 additions and 60 deletions

View File

@ -139,6 +139,7 @@ static inline void reset_LastError()
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/stat.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <sys/time.h> #include <sys/time.h>

View File

@ -35,26 +35,6 @@
const char *STEAM_PATH; const char *STEAM_PATH;
size_t STEAM_PATH_SIZE; size_t STEAM_PATH_SIZE;
#ifndef __x86_64__
# define _STAT_VER_LINUX_OLD 1
# define _STAT_VER_KERNEL 1
# define _STAT_VER_SVR4 2
# define _STAT_VER_LINUX 3
# define _MKNOD_VER_LINUX 1
# define _MKNOD_VER_SVR4 2
#else
# define _STAT_VER_KERNEL 0
# define _STAT_VER_LINUX 1
# define _MKNOD_VER_LINUX 0
#endif
#define _STAT_VER _STAT_VER_LINUX
#define _MKNOD_VER _MKNOD_VER_LINUX
/* From kernel_stat.h It help me save some condition */
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64
#define STAT_IS_KERNEL_STAT 1
// Returns a '/' terminated absolute path to the steam folder in user's home, // Returns a '/' terminated absolute path to the steam folder in user's home,
// root is returned if env home is not set // root is returned if env home is not set
const char *get_steam_path() const char *get_steam_path()
@ -311,16 +291,7 @@ STEAMAPI_API int __wrap_access(const char *path, int mode)
STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf) STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf)
{ {
const char *path_lowercased = lowercase_path(path, false, false); const char *path_lowercased = lowercase_path(path, false, false);
int result; int result = stat(path_lowercased, stat_buf);
switch (ver) {
case _STAT_VER_KERNEL:
result = stat(path_lowercased, stat_buf);
break;
default:
result = EINVAL;
}
if (path_lowercased != path) { if (path_lowercased != path) {
free((void *)path_lowercased); free((void *)path_lowercased);
} }
@ -335,16 +306,7 @@ STEAMAPI_API int __wrap_stat(const char * path, struct stat * stat_buf)
STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf) STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf)
{ {
const char *path_lowercased = lowercase_path(path, false, false); const char *path_lowercased = lowercase_path(path, false, false);
int result; int result = lstat(path_lowercased, stat_buf);
switch (ver) {
case _STAT_VER_KERNEL:
result = lstat(path_lowercased, stat_buf);
break;
default:
result = EINVAL;
}
if (path_lowercased != path) { if (path_lowercased != path) {
free((void *)path_lowercased); free((void *)path_lowercased);
} }
@ -389,16 +351,7 @@ STEAMAPI_API DIR *__wrap_opendir(const char *path)
STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf) STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf)
{ {
const char *path_lowercased = lowercase_path(path, false, false); const char *path_lowercased = lowercase_path(path, false, false);
int result; int result = stat64(path_lowercased, stat_buf);
switch (ver) {
case _STAT_VER_KERNEL:
result = stat64(path_lowercased, stat_buf);
break;
default:
result = EINVAL;
}
if (path_lowercased != path) { if (path_lowercased != path) {
free((void *)path_lowercased); free((void *)path_lowercased);
} }
@ -408,16 +361,7 @@ STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat
STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf) STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf)
{ {
const char *path_lowercased = lowercase_path(path, false, false); const char *path_lowercased = lowercase_path(path, false, false);
int result; int result = lstat64(path_lowercased, stat_buf);
switch (ver) {
case _STAT_VER_KERNEL:
result = lstat64(path_lowercased, stat_buf);
break;
default:
result = EINVAL;
}
if (path_lowercased != path) { if (path_lowercased != path) {
free((void *)path_lowercased); free((void *)path_lowercased);
} }