From 4c1fc3e404d648c70bd2f50ac50aeac6ece8872e Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Mon, 6 Jul 2015 19:19:25 -0400 Subject: 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. --- src/firstboot/firstboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/firstboot') diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index cda96d484a..3805b29437 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -415,7 +415,7 @@ static int process_hostname(void) { return 0; mkdir_parents(etc_hostname, 0755); - r = write_string_file(etc_hostname, arg_hostname); + r = write_string_file(etc_hostname, arg_hostname, WRITE_STRING_FILE_CREATE); if (r < 0) return log_error_errno(r, "Failed to write %s: %m", etc_hostname); @@ -436,7 +436,7 @@ static int process_machine_id(void) { return 0; mkdir_parents(etc_machine_id, 0755); - r = write_string_file(etc_machine_id, sd_id128_to_string(arg_machine_id, id)); + r = write_string_file(etc_machine_id, sd_id128_to_string(arg_machine_id, id), WRITE_STRING_FILE_CREATE); if (r < 0) return log_error_errno(r, "Failed to write machine id: %m"); -- cgit v1.2.3-54-g00ecf