1
0
Fork 0
forked from soccera/rdo

/run -> /var/run

Closes #17
This commit is contained in:
sw1tchbl4d3 2023-02-02 20:29:24 +01:00
parent bd8380d809
commit 6a34dbb90a

View file

@ -49,24 +49,24 @@ int getpstartts(int pid, unsigned long long* startts) {
int ensuredir() { int ensuredir() {
struct stat st; struct stat st;
int fd = open("/run/rdo", O_RDONLY, O_DIRECTORY | O_NOFOLLOW); int fd = open("/var/run/rdo", O_RDONLY, O_DIRECTORY | O_NOFOLLOW);
if (fd < 0) { if (fd < 0) {
if (errno == ENOENT) { if (errno == ENOENT) {
if (mkdir("/run/rdo", 0700) < 0) if (mkdir("/var/run/rdo", 0700) < 0)
err(1, "Could not create /run/rdo"); err(1, "Could not create /var/run/rdo");
fd = open("/run/rdo", O_RDONLY, O_DIRECTORY | O_NOFOLLOW); fd = open("/var/run/rdo", O_RDONLY, O_DIRECTORY | O_NOFOLLOW);
if (fd < 0) if (fd < 0)
err(1, "Could not open /run/rdo"); err(1, "Could not open /var/run/rdo");
} }
else else
err(1, "Could not open /run/rdo"); err(1, "Could not open /var/run/rdo");
} }
if (fstat(fd, &st) < 0) { if (fstat(fd, &st) < 0) {
close(fd); close(fd);
err(1, "Could not fstat /run/rdo"); err(1, "Could not fstat /var/run/rdo");
} }
close(fd); close(fd);
@ -87,7 +87,7 @@ void setsession(int pid, unsigned int ts_ttl, int ruid) {
if (ensuredir() < 0 || getpstartts(pid, &startts) < 0) if (ensuredir() < 0 || getpstartts(pid, &startts) < 0)
return; return;
snprintf(path, sizeof(path), "/run/rdo/%d-%d-%llu", ruid, pid, startts); snprintf(path, sizeof(path), "/var/run/rdo/%d-%d-%llu", ruid, pid, startts);
int fd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0700); int fd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0700);
if (fd < 0) { if (fd < 0) {
@ -118,7 +118,7 @@ int getsession(int pid, unsigned int ts_ttl, int ruid) {
if (ensuredir() < 0 || getpstartts(pid, &startts) < 0) if (ensuredir() < 0 || getpstartts(pid, &startts) < 0)
return -1; return -1;
snprintf(path, sizeof(path), "/run/rdo/%d-%d-%llu", ruid, pid, startts); snprintf(path, sizeof(path), "/var/run/rdo/%d-%d-%llu", ruid, pid, startts);
int fd = open(path, O_RDONLY); int fd = open(path, O_RDONLY);
if (fd < 0) { if (fd < 0) {