1
1

* src/utilunix.c (mc_tmpdir): Call mc_mkstemps() with an absolute

path to prevent stack overflows due to circular dependecy.
Этот коммит содержится в:
Pavel Tsekov 2007-01-02 15:55:01 +00:00
родитель 8113a37d37
Коммит cfdc950171
2 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,8 @@
2007-01-02 Pavel Tsekov <ptsekov@gmx.net>
* utilunix.c (mc_tmpdir): Call mc_mkstemps() with an absolute
path to prevent stack overflows due to circular dependecy.
2006-12-30 Grigory Trenin <gtrenin@gmail.com>
* help.c (startpoint): Remove global variable and all references

Просмотреть файл

@ -280,19 +280,18 @@ mc_tmpdir (void)
}
}
if (!error) {
tmpdir = buffer;
} else {
if (error != NULL) {
int test_fd;
char *test_fn;
char *test_fn, *fallback_prefix;
int fallback_ok = 0;
if (*error)
fprintf (stderr, error, buffer);
/* Test if sys_tmp is suitable for temporary files */
tmpdir = sys_tmp;
test_fd = mc_mkstemps (&test_fn, "mctest", NULL);
fallback_prefix = g_strdup_printf ("%s/mctest", sys_tmp);
test_fd = mc_mkstemps (&test_fn, fallback_prefix, NULL);
g_free (fallback_prefix);
if (test_fd != -1) {
close (test_fd);
test_fd = open (test_fn, O_RDONLY);
@ -306,16 +305,19 @@ mc_tmpdir (void)
if (fallback_ok) {
fprintf (stderr, _("Temporary files will be created in %s\n"),
sys_tmp);
g_snprintf (buffer, sizeof (buffer), "%s", sys_tmp);
error = NULL;
} else {
fprintf (stderr, _("Temporary files will not be created\n"));
tmpdir = "/dev/null/";
g_snprintf (buffer, sizeof (buffer), "%s", "/dev/null/");
}
fprintf (stderr, "%s\n", _("Press any key to continue..."));
getc (stdin);
}
tmpdir = buffer;
if (!error)
mc_setenv ("MC_TMPDIR", tmpdir, 1);