diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-15 19:09:02 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-15 19:28:55 +0200 |
commit | 14bcf25c8b94b5c3556ba3983028a2b35ed0572f (patch) | |
tree | d63090263d6927239b0ca3de20d21e5f95a9f878 /src/nspawn | |
parent | a4c8a5995102144225439c0077bbda5325761986 (diff) |
util: when creating temporary file names, allow including extra id string in it
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.
This also adds tests for the three call.
For now, we don't make use of this at all, but port all users over.
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index c87956bb01..7b22b8c21b 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -350,7 +350,7 @@ static int custom_mounts_prepare(void) { if (m->read_only) continue; - r = tempfn_random(m->source, &m->work_dir); + r = tempfn_random(m->source, NULL, &m->work_dir); if (r < 0) return log_error_errno(r, "Failed to generate work directory from %s: %m", m->source); } @@ -4522,9 +4522,9 @@ int main(int argc, char *argv[]) { goto finish; } if (r > 0) - r = tempfn_random_child(arg_directory, &np); + r = tempfn_random_child(arg_directory, NULL, &np); else - r = tempfn_random(arg_directory, &np); + r = tempfn_random(arg_directory, NULL, &np); if (r < 0) { log_error_errno(r, "Failed to generate name for snapshot: %m"); goto finish; |