summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-06 19:19:25 -0400
committerDaniel Mack <daniel@zonque.org>2015-07-06 19:19:25 -0400
commit4c1fc3e404d648c70bd2f50ac50aeac6ece8872e (patch)
tree977a223a8f5aa7fc2a5861a8d557b879bfc98a9f /src/udev
parent40beecdb6d1c73e5acb62ebac2ccbfd7891f2418 (diff)
fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index e27fb1fd9e..8a31089c0c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -398,7 +398,7 @@ static void worker_spawn(Manager *manager, struct event *event) {
prctl(PR_SET_PDEATHSIG, SIGTERM);
/* reset OOM score, we only protect the main daemon */
- write_string_file("/proc/self/oom_score_adj", "0");
+ write_string_file("/proc/self/oom_score_adj", "0", WRITE_STRING_FILE_CREATE);
for (;;) {
struct udev_event *udev_event;
@@ -1091,7 +1091,7 @@ static int synthesize_change(struct udev_device *dev) {
*/
log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
- write_string_file(filename, "change");
+ write_string_file(filename, "change", WRITE_STRING_FILE_CREATE);
udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
@@ -1106,7 +1106,7 @@ static int synthesize_change(struct udev_device *dev) {
log_debug("device %s closed, synthesising partition '%s' 'change'",
udev_device_get_devnode(dev), udev_device_get_devnode(d));
strscpyl(filename, sizeof(filename), udev_device_get_syspath(d), "/uevent", NULL);
- write_string_file(filename, "change");
+ write_string_file(filename, "change", WRITE_STRING_FILE_CREATE);
}
return 0;
@@ -1114,7 +1114,7 @@ static int synthesize_change(struct udev_device *dev) {
log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
- write_string_file(filename, "change");
+ write_string_file(filename, "change", WRITE_STRING_FILE_CREATE);
return 0;
}
@@ -1747,7 +1747,7 @@ int main(int argc, char *argv[]) {
setsid();
- write_string_file("/proc/self/oom_score_adj", "-1000");
+ write_string_file("/proc/self/oom_score_adj", "-1000", WRITE_STRING_FILE_CREATE);
}
r = run(fd_ctrl, fd_uevent, cgroup);