mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +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);
|
||||
} else {
|
||||
const char *uname = getenv("USER");
|
||||
if (uname == NULL) {
|
||||
struct passwd userinfo;
|
||||
struct passwd *result;
|
||||
char buf[8192];
|
||||
int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result);
|
||||
if (!retval && result) uname = userinfo.pw_name;
|
||||
// $USER should already have been set (in setup_path()).
|
||||
// If it still isn't, there's something wrong.
|
||||
if (!uname) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// /tmp/fish.user
|
||||
std::string tmpdir = "/tmp/fish.";
|
||||
tmpdir.append(uname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user