]> Savannah Git Hosting - gnulib.git/commit
tempname: new try_tempname function
authorAndreas Gruenbacher <agruen@gnu.org>
Sat, 31 Jan 2015 22:49:13 +0000 (23:49 +0100)
committerAndreas Gruenbacher <agruenba@schleppi.home>
Wed, 4 Feb 2015 09:49:13 +0000 (10:49 +0100)
commit56e31f06e11972fc8335152717c5cf7d07d40998
tree854d967f3f32164cc575f43e5ce308891b20f81e
parent6c8f206bb39e9d4c322d6f12d532f38c9df2dac3
tempname: new try_tempname function

The way how gen_tempname() creates files is not always sufficient. For example,
it may make sense to create directories when creating the temporary file or
directory fails with errno set to ENOENT.  Add a try_tempname() variant of
gen_tempname() that allows that. Implement gen_tempname() on top of it.

* lib/tempname.c (try_tempname): New function and backend of gen_tempname().
(try_file, try_dir, try_nocreate): Callbacks to use for the different kinds
that gen_tempname supports (GT_FILE, GT_DIR, GT_NOCREATE).
* lib/tempname.h (try_tempname): Declare here.
* modules/tempname: Mention try_tempname.
lib/tempname.c
lib/tempname.h
modules/tempname