mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-31 08:43:14 +00:00
better check for lock dir
Consider the case where we're running in a user namespace but in the host's mount ns with the host's filesystem (something like lxc-usernsexec ... lxc-execute ...), in this case, we'll be euid 0, but we can't actually write to /run. Let's improve this locking check to make sure we can actually write to /run before we decide to actually use it as our locking dir. Signed-off-by: Tycho Andersen <tycho@tycho.ws>
This commit is contained in:
parent
3fdb1cf431
commit
9650c735c7
@ -245,8 +245,13 @@ char *get_rundir()
|
||||
{
|
||||
char *rundir;
|
||||
const char *homedir;
|
||||
struct stat sb;
|
||||
|
||||
if (geteuid() == 0) {
|
||||
if (stat(RUNTIME_PATH, &sb) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (geteuid() == sb.st_uid || getegid() == sb.st_gid) {
|
||||
rundir = strdup(RUNTIME_PATH);
|
||||
return rundir;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user