fix(ipc): Fallback folder not being user-specific (#2684)
If two users start a bar with IPC and don't have XDG_RUNTIME_DIR set, polybar will create the fallback directory `/tmp/polybar`. However, that directory is only accessible by the user that created it and so polybar running under the second user will fail to open its socket there. We add the UID to the fallback directory to prevent this. Fixes #2683
This commit is contained in:
parent
7d9227cb08
commit
146c1ac1d7
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
- `custom/script`: Output clearing when `exec-if` fails ([`#2674`](https://github.com/polybar/polybar/issues/2674))
|
- `custom/script`: Output clearing when `exec-if` fails ([`#2674`](https://github.com/polybar/polybar/issues/2674))
|
||||||
- `internal/battery`: `poll-interval` not working ([`#2649`](https://github.com/polybar/polybar/issues/2649), [`#2677`](https://github.com/polybar/polybar/pull/2677))
|
- `internal/battery`: `poll-interval` not working ([`#2649`](https://github.com/polybar/polybar/issues/2649), [`#2677`](https://github.com/polybar/polybar/pull/2677))
|
||||||
|
- ipc: Polybar failing to open IPC channel after another user already ran polybar, if `XDG_RUNTIME_DIR` is not set ([`#2683`](https://github.com/polybar/polybar/issues/2683), [`#2684`](https://github.com/polybar/polybar/pull/2684))
|
||||||
|
|
||||||
## [3.6.2] - 2022-04-03
|
## [3.6.2] - 2022-04-03
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <uv.h>
|
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
@ -94,6 +92,6 @@ namespace ipc {
|
|||||||
void receive_data(string buf);
|
void receive_data(string buf);
|
||||||
void receive_eof();
|
void receive_eof();
|
||||||
};
|
};
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "components/controller.hpp"
|
#include "components/controller.hpp"
|
||||||
|
|
||||||
#include <uv.h>
|
|
||||||
|
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "ipc/util.hpp"
|
#include "ipc/util.hpp"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "errors.hpp"
|
#include "errors.hpp"
|
||||||
#include "utils/env.hpp"
|
#include "utils/env.hpp"
|
||||||
@ -12,8 +13,14 @@ POLYBAR_NS
|
|||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
||||||
static constexpr auto SUFFIX = ".sock";
|
static constexpr auto SUFFIX = ".sock";
|
||||||
|
static constexpr auto XDG_RUNTIME_DIR = "XDG_RUNTIME_DIR";
|
||||||
|
|
||||||
string get_runtime_path() {
|
string get_runtime_path() {
|
||||||
|
if (env_util::has(XDG_RUNTIME_DIR)) {
|
||||||
|
return env_util::get("XDG_RUNTIME_DIR") + "/polybar";
|
||||||
|
} else {
|
||||||
|
return "/tmp/polybar-" + to_string(getuid());
|
||||||
|
}
|
||||||
return env_util::get("XDG_RUNTIME_DIR", "/tmp") + "/polybar";
|
return env_util::get("XDG_RUNTIME_DIR", "/tmp") + "/polybar";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +66,6 @@ namespace ipc {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
Loading…
Reference in New Issue
Block a user