Re: Patch to reduce usage of tempnam()


: This patch should make it easier to work with temporary files - it adds a
: new function mc_mkstemps(), similar to mkstemps() from libibery and C
: library on OpenBSD.

Patch looks good, but it is really bad idea to cache location of tmpdir.
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 

: 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.
. . .
: --- src/util.h
: +++ src/util.h
: @@ -146,6 +146,10 @@
:  extern char app_text [];
: +/* Creating temporary files safely */
: +void init_tmpdir(void);
: +int mc_mkstemps(char **pname, const char *prefix, const char *suffix);
: +

Good luck!

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