Inside container, writing file returns EACCESS. Moreover, some devices
return ENODEV rather than EACCES. So, let's also ignore these two
error causes.
Closes #13652.
r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0) {
- log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r,
+ bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV);
+
+ log_full_errno(ignore ? LOG_DEBUG : LOG_ERR, r,
"Failed to write '%s' to '%s': %m", action, filename);
- if (ret == 0 && r != -ENOENT)
+ if (ret == 0 && !ignore)
ret = r;
continue;
}