aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io/FileOutputStream.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-05 20:24:59 +0100
committerMax Kellermann <max@duempel.org>2015-01-06 19:38:55 +0100
commit8b217d531305433df01c789dab4dc81d58f05eba (patch)
treee81465cd429cfeaf12d49a4e128a8bcc703a4e9d /src/fs/io/FileOutputStream.hxx
parentac62586badd439dfcc43df6a895f2988eb784e6d (diff)
downloadmpd-8b217d531305433df01c789dab4dc81d58f05eba.tar.gz
mpd-8b217d531305433df01c789dab4dc81d58f05eba.tar.xz
mpd-8b217d531305433df01c789dab4dc81d58f05eba.zip
fs/io/FileOutputStream: use O_TMPFILE if available
The Linux feature allows writing new files to an invisible file, and then replace the old file. This preserves the old file if we get interrupted by some event.
Diffstat (limited to 'src/fs/io/FileOutputStream.hxx')
-rw-r--r--src/fs/io/FileOutputStream.hxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fs/io/FileOutputStream.hxx b/src/fs/io/FileOutputStream.hxx
index 5ac2f9e15..03d062134 100644
--- a/src/fs/io/FileOutputStream.hxx
+++ b/src/fs/io/FileOutputStream.hxx
@@ -42,6 +42,14 @@ class FileOutputStream final : public OutputStream {
int fd;
#endif
+#ifdef HAVE_LINKAT
+ /**
+ * Was O_TMPFILE used? If yes, then linkat() must be used to
+ * create a link to this file.
+ */
+ bool is_tmpfile;
+#endif
+
public:
FileOutputStream(Path _path, Error &error);