Re: Patch to reduce usage of tempnam()

Hi, Pavels!
: > As for me it should be fine to write some code to add possibility for
: > changing $TMPDIR on the fly. Not all of us are system administrators, so
: > it be really good doesn't restart mc when there isn't enough free space in
: > /tmp.
: 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!

: > : The difference is that mc_mkstemps creates the template for you and even
: > : adds the directory name (/tmp or $TMPDIR if set). It can be changed to
: > : call the native mkstemps if it's available.
: >
: > This one is declared as
: >     int mkstemps(char *template, int suffixlen)
: > on FreeBSD.
: I know. It also exists on OpenBSD. It's also implemented in libiberty,
: part of gcc and binutils, but it's not in glibc 2.2 for some reason. I'll
: try to use it if possible.

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.
  2) This filenames are constructed by g_strconcat (), so they must be 
     g_free()d, not free()d. (ext.c and user.c)
  3) Optionally, may be it is more right to assign pname with NULL on error.


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