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

Simon Matter simon.matter at invoca.ch
Wed Jan 14 23:01:20 UTC 2009


> "m. allan noah" <kitno455 at gmail.com> wrote:
>
>> True enough, So, instead of using mktemp at all, why not do something
>> like append '.part' to the image name? I think that is a little more
>> clear to the end user if they find some hanging around after a
>> scanimage crash or something.
>
> Absolutely, especially if this all happens in the working directory.

It has to be in the same directory like the target files or rename() could
fail as I understand it. But of course it's not really the current working
directory because output filespec can include a path, relative or
absolute.
My intention for using mktemp() was to make sure that one scanimage
process does in any case rename only it's own file, even if a concurrent
scanimage process (maybe handling a different device) uses the same output
file name.

Anyway I'll remove mktemp() tomorrow.

Regards,
Simon




More information about the sane-devel mailing list