* 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.
This commit is contained in:
Andrew V. Samoilov 2002-10-22 11:21:40 +00:00
parent 562cc18d4f
commit 499aa8c24f
2 changed files with 13 additions and 8 deletions

View File

@ -1,13 +1,17 @@
2002-10-22 Andrew V. Samoilov <sav@bcs.zp.ua>
* 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 <proski@gnu.org>
* 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 <sav@bcs.zp.ua>
* man2hlp.c (handle_link): Don't strip leading space(s) from
linkname.
2002-10-21 Pavel Roskin <proski@gnu.org>
* main.c (print_mc_usage): Remove unnecessary newline.

View File

@ -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;
}
}