aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-12-27 09:45:56 +0100
committerAdrian Kummerlaender2015-12-27 09:45:56 +0100
commit0f1b6aea1fc7a2753cfde98a74c1ab74e258576e (patch)
tree22bdd93e2f10a24a929959926d6e175405641762
parent9975a920820cd85e5b1d276bd1eae0dacf6b56a0 (diff)
downloadchange-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar.gz
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar.bz2
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar.lz
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar.xz
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.tar.zst
change-0f1b6aea1fc7a2753cfde98a74c1ab74e258576e.zip
Explicitly set log file permissions
This ensures that the log file is actually accessable - there was a problem where e.g. `change rm test` did not create the log file correctly.
-rwxr-xr-xchange2
-rw-r--r--src/change_log.cc2
-rw-r--r--src/utility/io.h2
-rw-r--r--src/utility/logger.h2
4 files changed, 3 insertions, 5 deletions
diff --git a/change b/change
index 5d1877a..344a650 100755
--- a/change
+++ b/change
@@ -5,4 +5,4 @@ export CHANGE_LOG_TARGET="/tmp/$(basename $0).$$.tmp"
LD_PRELOAD=libChangeLog.so eval "$@"
cat $CHANGE_LOG_TARGET
-rm -f $CHANGE_LOG_TARGET
+rm -f $CHANGE_LOG_TARGET
diff --git a/src/change_log.cc b/src/change_log.cc
index a0c929d..4caaa6a 100644
--- a/src/change_log.cc
+++ b/src/change_log.cc
@@ -62,7 +62,7 @@ int rmdir(const char* path) {
int unlink(const char* path) {
if ( utility::is_regular_file(path) ) {
- logger->append("rm '" + std::string(path) + "'");
+ logger->append("remove '" + std::string(path) + "'");
}
return actual::unlink(path);
diff --git a/src/utility/io.h b/src/utility/io.h
index ed1f542..32d6ecb 100644
--- a/src/utility/io.h
+++ b/src/utility/io.h
@@ -13,7 +13,7 @@ namespace utility {
class FileDescriptorGuard {
public:
FileDescriptorGuard(const std::string& path) {
- this->fd_ = open(path.c_str(), O_CREAT | O_WRONLY | O_APPEND);
+ this->fd_ = open(path.c_str(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
if ( !this->fd_ ) {
this->fd_ = STDERR_FILENO;
diff --git a/src/utility/logger.h b/src/utility/logger.h
index 475f33d..e21f6fd 100644
--- a/src/utility/logger.h
+++ b/src/utility/logger.h
@@ -5,8 +5,6 @@
#include <boost/process.hpp>
-#include <iostream>
-
namespace utility {
class Logger {