Re: Patch to reduce usage of tempnam()



Hi, Andrew!

> : I know that MC is the biggest consumer of the /tmp space on all my
> : systems. Restarting MC is not a big deal, but having a separate directory
> : for temporary files would be nice. Maybe I'll add support for MC_TMPDIR.
>
> I don't agree! It's nice to have only one environment variable TMPDIR
> for all programs!

Of course I didn't mean to remove support for TMPDIR completely. You can
have one variable as long as you don't define program-specific variables.

> I reviewed your patch and have some remarks now:
>
>   1) I think generated filename must be returned anyway. Temporary files must
>      be unlinked after use, but it is possible only if a filename is known.

That's correct. I couldn't find any function to unlink a file given its
open descriptor.

I'll probably disable support for NULL as the first argument - its not
used now and I cannot see how it can be used in MC.

>   2) This filenames are constructed by g_strconcat (), so they must be
>      g_free()d, not free()d. (ext.c and user.c)

Good hit! I was under wrong impression that MC is using g_free()
consistently. I should have learned that consistency and MC don't come
together :-)

I'll fix it shortly.

>   3) Optionally, may be it is more right to assign pname with NULL on error.

Again, I agree! This would save us several calls to g_free().

-- 
Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]