[sane-devel] PATCH: Make creation of output files of scanimage batch mode atomic

Simon Matter simon.matter at invoca.ch
Wed Jan 14 19:56:37 UTC 2009

> "Simon Matter" <simon.matter at invoca.ch> wrote:
> Hi,
>> It creates a temp file using (unsecure) mktemp(3) and writes to it
>                                 ^^^^^^^^
>> Would be nice if that one could go into CVS.
> Regardless of anything else in the patch, you know what you have to do
> if you want that to happen :-)

Well, there are a number of reason why I did choose mktemp() here:
1) it seems mkstemp() is not available on all systems targeted by SANE.
2) mktemp() is used as the mktemp of choice in other parts of the SANE
code. (the same applies to functions like usleep() which should be
replaced by nanosleep() but may not be available everywhere).
3) from what I understand using mktemp() here is not less secure than what
scanimage does when writing output files anyway.

So to make things look better, change that to "It creates a temp file and
writes to it" :)


More information about the sane-devel mailing list