From 691eefe0dea3793271d956e29ed310e10ce8ca78 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Sun, 15 Feb 2015 19:51:40 +0200 Subject: [PATCH] Fixed log manager writing to the file when it checks that they exist. --- log_manager/log_manager.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index 04eef42e4..c9826b08a 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -2356,7 +2356,7 @@ static bool check_file_and_path( /** File exists, check permission to read/write */ if (errno == EEXIST) { - /** Open file and write a byte for test */ + /** Open file */ fd = open(filename, O_CREAT|O_RDWR, S_IRWXU|S_IRWXG); if (fd == -1) @@ -2387,8 +2387,7 @@ static bool check_file_and_path( { if (writable) { - char c = ' '; - if (write(fd, &c, 1) == 1) + if (access(filename,W_OK) == 0) { *writable = true; }