diff --git a/src/env.cpp b/src/env.cpp index d4736ca63..13490acd4 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -702,11 +702,11 @@ wcstring env_get_pwd_slash(void) { /// Set up the USER variable. static void setup_user(bool force) { if (env_get_string(L"USER").missing_or_empty() || force) { - struct passwd userinfo; - struct passwd *result; - char buf[8192]; - int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result); - if (!retval && result) { + struct passwd userinfo; + struct passwd *result; + char buf[8192]; + int retval = getpwuid_r(getuid(), &userinfo, buf, sizeof(buf), &result); + if (!retval && result) { const wcstring uname = str2wcstring(userinfo.pw_name); env_set(L"USER", uname.c_str(), ENV_GLOBAL | ENV_EXPORT); } diff --git a/src/fish_key_reader.cpp b/src/fish_key_reader.cpp index 2b40e16d0..e3b19a876 100644 --- a/src/fish_key_reader.cpp +++ b/src/fish_key_reader.cpp @@ -92,9 +92,7 @@ static char *sequence_name(wchar_t wc) { /// Return true if the character must be escaped when used in the sequence of chars to be bound in /// a `bind` command. -static bool must_escape(wchar_t wc) { - return wcschr(L"[]()<>{}*\\?$#;&|'\"", wc) != NULL; -} +static bool must_escape(wchar_t wc) { return wcschr(L"[]()<>{}*\\?$#;&|'\"", wc) != NULL; } static void ctrl_to_symbol(wchar_t *buf, int buf_len, wchar_t wc, bool bind_friendly) { if (ctrl_symbolic_names[wc]) { diff --git a/src/reader.cpp b/src/reader.cpp index 1a84a135a..b1be59d51 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1517,9 +1517,9 @@ static bool check_for_orphaned_process(unsigned long loop_count, pid_t shell_pgi we_think_we_are_orphaned = true; } + // Try reading from the tty; if we get EIO we are orphaned. This is sort of bad because it + // may block. if (!we_think_we_are_orphaned && loop_count % 128 == 0) { - // Try reading from the tty; if we get EIO we are orphaned. This is sort of bad because it - // may block. #ifdef HAVE_CTERMID_R char buf[L_ctermid]; char *tty = ctermid_r(buf);