summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-12-13 11:45:01 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-12-13 13:03:14 +0000
commitda2d1421143038a648473402f1e6fd17be05fd0c (patch)
treeaea71fc3f66e046706287bcda1dc83133af8ac7c /src/libsystemd
parenta6f72863adda77b3b6c7b08b0c85f41c6ba2a6d1 (diff)
sd-id128: id128_write overwrites target file
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-id128/id128-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd/sd-id128/id128-util.c b/src/libsystemd/sd-id128/id128-util.c
index 337eae24b4..e6d45c18e3 100644
--- a/src/libsystemd/sd-id128/id128-util.c
+++ b/src/libsystemd/sd-id128/id128-util.c
@@ -186,7 +186,7 @@ int id128_write_fd(int fd, Id128Format f, sd_id128_t id, bool do_sync) {
int id128_write(const char *p, Id128Format f, sd_id128_t id, bool do_sync) {
_cleanup_close_ int fd = -1;
- fd = open(p, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
+ fd = open(p, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY|O_TRUNC, 0444);
if (fd < 0)
return -errno;