summaryrefslogtreecommitdiff
path: root/src/basic/fileio.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-12 17:04:27 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commitdd656b3679e4b5a7ec3534bf8786b022327e080d (patch)
tree6b9e903037c207344610befd40dd4cee2f8abe9a /src/basic/fileio.c
parent3f87ae2530d8bb022f54526c3a568165a34acf05 (diff)
tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r--src/basic/fileio.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 2d742c911..afe2fd17b 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
Copyright 2010 Lennart Poettering
***/
@@ -1571,29 +1569,21 @@ int read_nul_string(FILE *f, char **ret) {
}
int mkdtemp_malloc(const char *template, char **ret) {
- _cleanup_free_ char *p = NULL;
- int r;
+ char *p;
+ assert(template);
assert(ret);
- if (template)
- p = strdup(template);
- else {
- const char *tmp;
-
- r = tmp_dir(&tmp);
- if (r < 0)
- return r;
-
- p = strjoin(tmp, "/XXXXXX");
- }
+ p = strdup(template);
if (!p)
return -ENOMEM;
- if (!mkdtemp(p))
+ if (!mkdtemp(p)) {
+ free(p);
return -errno;
+ }
- *ret = TAKE_PTR(p);
+ *ret = p;
return 0;
}
#endif // 0