mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
Steam updates: rewrite read-only content files the way root could
The client runs as proot's root, which the kernel does not see, and leaves many content files read-only; an update that rewrites one was refused (EACCES) and cancelled with "Missing file permissions" (Proton Experimental (ARM64), wineopenxr.dll). For the client's own processes, a refused write-open of a file the app owns now gets the owner's write bit - on the file, or on the directory a new file goes into - and one more try. Games and Wine keep ordinary permissions.
This commit is contained in:
1 parent
7aa760b696
commit
a9125900a2
2 files changed
+80
No files matched your search
@@ -34,6 +34,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
int bl_status_without_tracer(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_writable_retry(int dirfd, const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
|
||||
static int retry_without_noatime(int fd, int flags) {
|
||||
return fd < 0 && errno == EPERM && (flags & O_NOATIME);
|
||||
@@ -67,6 +68,8 @@ int open(const char *path, int flags, ...) {
|
||||
}
|
||||
fd = real_open(path, flags, mode);
|
||||
if (retry_without_noatime(fd, flags)) fd = real_open(path, flags & ~O_NOATIME, mode);
|
||||
/* A read-only file the Steam client rewrites (perms.c). */
|
||||
if (fd < 0 && bl_writable_retry(AT_FDCWD, path, flags)) fd = real_open(path, flags & ~O_NOATIME, mode);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -91,6 +94,7 @@ int openat(int dirfd, const char *path, int flags, ...) {
|
||||
}
|
||||
fd = real_openat(dirfd, path, flags, mode);
|
||||
if (retry_without_noatime(fd, flags)) fd = real_openat(dirfd, path, flags & ~O_NOATIME, mode);
|
||||
if (fd < 0 && bl_writable_retry(dirfd, path, flags)) fd = real_openat(dirfd, path, flags & ~O_NOATIME, mode);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user