summaryrefslogtreecommitdiff
path: root/src/basic/fileio.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>2017-08-29 10:56:32 +0100
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>2017-08-29 10:56:32 +0100
commit265710c2055254a98ed6dcd6aa172ca509a33553 (patch)
treeac87f82e417d2334798f75842b55693899664f85 /src/basic/fileio.c
parent0675e94ab53237ad27bfba929c7490bdd2215cf1 (diff)
downloadsystemd-265710c2055254a98ed6dcd6aa172ca509a33553.tar.gz
systemd-265710c2055254a98ed6dcd6aa172ca509a33553.tar.bz2
systemd-265710c2055254a98ed6dcd6aa172ca509a33553.zip
fileio: rename function parameter to avoid masking global symbol
> glibc exports a function called sync(), we should probably avoid > overloading that as a variable here locally (gcc even used to warn about > that, not sure why it doesn't anymore), to avoid confusion around what > "if (sync)" actually means
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r--src/basic/fileio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 277aea51a9..6220d1c11d 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -71,7 +71,7 @@ int write_string_stream_ts(FILE *f, const char *line, bool enforce_newline, stru
return fflush_and_check(f);
}
-static int write_string_file_atomic(const char *fn, const char *line, bool enforce_newline, bool sync) {
+static int write_string_file_atomic(const char *fn, const char *line, bool enforce_newline, bool do_fsync) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *p = NULL;
int r;
@@ -86,7 +86,7 @@ static int write_string_file_atomic(const char *fn, const char *line, bool enfor
(void) fchmod_umask(fileno(f), 0644);
r = write_string_stream(f, line, enforce_newline);
- if (r >= 0 && sync)
+ if (r >= 0 && do_fsync)
r = fflush_sync_and_check(f);
if (r >= 0) {
@@ -107,8 +107,8 @@ int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags
assert(fn);
assert(line);
- /* We don't know how to verify whether the file contents is on-disk. */
- assert(!((flags & WRITE_STRING_FILE_SYNC) && (flags & WRITE_STRING_FILE_VERIFY_ON_FAILURE)));
+ /* We don't know how to verify whether the file contents was already on-disk. */
+ assert(!((flags & WRITE_STRING_FILE_VERIFY_ON_FAILURE) && (flags & WRITE_STRING_FILE_SYNC)));
if (flags & WRITE_STRING_FILE_ATOMIC) {
assert(flags & WRITE_STRING_FILE_CREATE);