summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-15 14:34:33 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-15 14:35:51 +0200
commit03ad1136ba6ddaeca626aa24362dab764c7e2398 (patch)
treece6974472210b41e157861de54a475e7cd9718fd /src/tmpfiles
parent04fb63514d1c98fdf9c9549639a1f6d9812444ac (diff)
tmpfiles: if we are supposed to write a string to a file, it's OK if we can't write the trailing newline
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 235617853b..2ee0601e64 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -617,8 +617,13 @@ static int create_item(Item *i) {
iovec[1].iov_len = 1;
n = writev(fd, iovec, 2);
- if (n < 0 || (size_t) n != l+1) {
- log_error("Failed to write file %s: %s", i->path, n < 0 ? strerror(-n) : "Short");
+
+ /* It's OK if we don't write the trailing
+ * newline, hence we check for l, instead of
+ * l+1 here. Files in /sys often refuse
+ * writing of the trailing newline. */
+ if (n < 0 || (size_t) n < l) {
+ log_error("Failed to write file %s: %s", i->path, n < 0 ? strerror(-n) : "Short write");
close_nointr_nofail(fd);
return n < 0 ? n : -EIO;
}