diff --git a/src/ChangeLog b/src/ChangeLog index e48c92818..d48f19c9c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,13 +1,17 @@ +2002-10-22 Andrew V. Samoilov + + * utilunix.c (mc_tmpdir): Make directory only if not exists. + Use strncpy() instead of g_snprintf() - there can be printf() + pattern(s) in the $TMPDIR. + + * man2hlp.c (handle_link): Don't strip leading space(s) from + linkname. + 2002-10-22 Pavel Roskin * myslang.h: Add a replacement for addch(), which expects a wchar_t argument in patched S-Lang on Red Hat 8.0. -2002-10-21 Andrew V. Samoilov - - * man2hlp.c (handle_link): Don't strip leading space(s) from - linkname. - 2002-10-21 Pavel Roskin * main.c (print_mc_usage): Remove unnecessary newline. diff --git a/src/utilunix.c b/src/utilunix.c index 56f96553c..c95c2235d 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -324,13 +324,14 @@ mc_tmpdir (void) pwd->pw_name); canonicalize_pathname (tmpdir); - if (chmod (tmpdir, S_IRWXU) != 0) { - /* Need to create directory. */ + if (chmod (tmpdir, S_IRWXU) != 0 && errno == ENOENT) { + /* Need to create directory. */ if (mkdir (tmpdir, S_IRWXU) != 0) { fprintf (stderr, _("Cannot create temporary directory %s: %s\n"), tmpdir, unix_error_string (errno)); - g_snprintf (tmpdir, sizeof (tmpdir), sys_tmp); + strncpy (tmpdir, sys_tmp, sizeof (tmpdir) - 1); + tmpdir [sizeof (tmpdir) - 1] = 0; } }