diff options
author | Daniel Carl <danielcarl@gmx.de> | 2014-04-09 23:06:42 +0200 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2014-04-09 23:06:42 +0200 |
commit | 13296a8d0dfe86793fe6507e4da05047e3d47c51 (patch) | |
tree | 57b818a0532ea571cac6152a486e759d6d5a76cc /src/util.c | |
parent | 809ca39344ea25a554588126e463d85d27d67746 (diff) |
Removed obsolete FILE_LOCK_SET macro.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -18,6 +18,7 @@ */ #include "config.h" +#include <sys/file.h> #include <stdio.h> #include <pwd.h> #include <ctype.h> @@ -168,13 +169,13 @@ gboolean util_file_append(const char *file, const char *format, ...) FILE *f; if ((f = fopen(file, "a+"))) { - FILE_LOCK_SET(fileno(f), F_WRLCK); + flock(fileno(f), LOCK_EX); va_start(args, format); vfprintf(f, format, args); va_end(args); - FILE_LOCK_SET(fileno(f), F_UNLCK); + flock(fileno(f), LOCK_UN); fclose(f); return true; @@ -197,7 +198,7 @@ gboolean util_file_prepend(const char *file, const char *format, ...) content = util_get_file_contents(file, NULL); if ((f = fopen(file, "w"))) { - FILE_LOCK_SET(fileno(f), F_WRLCK); + flock(fileno(f), LOCK_EX); va_start(args, format); /* write new content to the file */ @@ -207,7 +208,7 @@ gboolean util_file_prepend(const char *file, const char *format, ...) /* append previous file content */ fputs(content, f); - FILE_LOCK_SET(fileno(f), F_UNLCK); + flock(fileno(f), LOCK_UN); fclose(f); res = true; |