diff options
| author | 2020-02-04 23:10:46 +0530 | |
|---|---|---|
| committer | 2020-02-04 23:21:50 +0530 | |
| commit | 6d77b040329e28af26859664090212bf0254119f (patch) | |
| tree | 22a4b0b68055350854650bd661cd92362a6322db /src | |
| parent | 05ae384b2debab8477131cc25213e6a0d5d21351 (diff) | |
| download | nnn-6d77b040329e28af26859664090212bf0254119f.tar.gz | |
Minor refactor
Diffstat (limited to 'src')
| -rw-r--r-- | src/nnn.c | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -6395,21 +6395,16 @@ static bool setup_config(void) static bool set_tmp_path(void) { - char *path; + char *tmp = "/tmp"; + char *path = xdiraccess(tmp) ? tmp : getenv("TMPDIR"); - if (xdiraccess("/tmp")) - g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, "/tmp", TMP_LEN_MAX); - else { - path = getenv("TMPDIR"); - if (path) - g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, path, TMP_LEN_MAX); - else { - fprintf(stderr, "set TMPDIR\n"); - return FALSE; - } - } + if (!path) { + fprintf(stderr, "set TMPDIR\n"); + return FALSE; + } - return TRUE; + g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, path, TMP_LEN_MAX); + return TRUE; } static void cleanup(void) |