chiark / gitweb /
fileio: imply /tmp as directory if passed as NULL to open_tmpfile_unlinkable()
authorLennart Poettering <lennart@poettering.net>
Mon, 25 Jul 2016 18:35:04 +0000 (20:35 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:13:01 +0000 (10:13 +0200)
We can make this smarter one day, to honour $TMPDIR and friends, but for now,
let's just use /tmp.

src/basic/fileio.c

index 525cca7..42de50d 100644 (file)
@@ -1264,7 +1264,8 @@ int open_tmpfile_unlinkable(const char *directory, int flags) {
         char *p;
         int fd;
 
-        assert(directory);
+        if (!directory)
+                directory = "/tmp";
 
         /* Returns an unlinked temporary file that cannot be linked into the file system anymore */