mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Fix segfault related to getting the uvar pipe path
This tried setting $USER (again), but did it wrong. Fixes #4229 TO THE MAXXX.
This commit is contained in:
parent
e0f0164b16
commit
627ce4ea34
@ -140,14 +140,11 @@ static wcstring get_runtime_path() {
|
|||||||
result = str2wcstring(dir);
|
result = str2wcstring(dir);
|
||||||
} else {
|
} else {
|
||||||
const char *uname = getenv("USER");
|
const char *uname = getenv("USER");
|
||||||
if (uname == NULL) {
|
// $USER should already have been set (in setup_path()).
|
||||||
struct passwd userinfo;
|
// If it still isn't, there's something wrong.
|
||||||
struct passwd *result;
|
if (!uname) {
|
||||||
char buf[8192];
|
return result;
|
||||||
int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result);
|
|
||||||
if (!retval && result) uname = userinfo.pw_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /tmp/fish.user
|
// /tmp/fish.user
|
||||||
std::string tmpdir = "/tmp/fish.";
|
std::string tmpdir = "/tmp/fish.";
|
||||||
tmpdir.append(uname);
|
tmpdir.append(uname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user