mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(mc_tmpdir): reduce variable scope.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d6a93efb2b
commit
d2aa6486dd
@ -776,13 +776,17 @@ mc_tmpdir (void)
|
||||
static char buffer[PATH_MAX];
|
||||
static const char *tmpdir = NULL;
|
||||
const char *sys_tmp;
|
||||
struct stat st;
|
||||
gchar *template;
|
||||
|
||||
/* Check if already correctly initialized */
|
||||
if (tmpdir != NULL && lstat (tmpdir, &st) == 0 && S_ISDIR (st.st_mode) &&
|
||||
st.st_uid == getuid () && (st.st_mode & 0777) == 0700)
|
||||
return tmpdir;
|
||||
if (tmpdir != NULL)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (lstat (tmpdir, &st) == 0 && S_ISDIR (st.st_mode) && st.st_uid == getuid ()
|
||||
&& (st.st_mode & 0777) == 0700)
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
sys_tmp = getenv ("MC_TMPDIR");
|
||||
if (sys_tmp == NULL || !IS_PATH_SEP (sys_tmp[0]))
|
||||
|
Loading…
Reference in New Issue
Block a user