Re: [PATCH] mc crashes when temporary directory cannot be created
- From: Leonard den Ottolander <leonard den ottolander nl>
- To: Jindrich Novy <jnovy redhat com>
- Cc: MC development <mc-devel gnome org>
- Subject: Re: [PATCH] mc crashes when temporary directory cannot be created
- Date: Wed, 29 Nov 2006 20:59:28 +0100
Hello Jindrich,
On Tue, 2006-11-28 at 13:21 +0100, Jindrich Novy wrote:
> IMO only removal of the fallback will prevent
> the infinite loop in any case as it shouldn't call mc_mkstemps() at all.
That cure seems worse than the disease. Isn't the real problem the fact
that mc_mkstemps() blindly concats tmpdir to the prefix instead of
testing if mc_tmpdir() succeeded? Why not abort mc_mkstemps() if
mc_tmpdir() returns "/dev/null/"?
What about the attached (untested) patch?
By the way, could you please add the -p option to your diffs?
Bye,
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
--- util.c.000 2005-11-10 21:50:22.000000000 +0100
+++ util.c 2006-11-29 20:56:21.000000000 +0100
@@ -1301,14 +1301,18 @@ mc_mkstemps (char **pname, const char *p
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static unsigned long value;
struct timeval tv;
+ char *tmpdir;
char *tmpbase;
char *tmpname;
char *XXXXXX;
int count;
if (strchr (prefix, PATH_SEP) == NULL) {
+ tmpdir = mc_tmpdir ();
+ if (strcmp (tmpdir, "/dev/null/") == 0)
+ return -1;
/* Add prefix first to find the position of XXXXXX */
- tmpbase = concat_dir_and_file (mc_tmpdir (), prefix);
+ tmpbase = concat_dir_and_file (tmpdir, prefix);
} else {
tmpbase = g_strdup (prefix);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]