aboutsummaryrefslogtreecommitdiff
path: root/src/change_log.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-12-21 12:18:46 +0100
committerAdrian Kummerlaender2015-12-21 12:18:46 +0100
commitb02091f847b94e94db465469e723fcf2aee81a01 (patch)
tree25206750bd201434c859b084eda4be3263d88873 /src/change_log.cc
parent30d28c558015afe22822647cc3943e2afb14afde (diff)
downloadchange-b02091f847b94e94db465469e723fcf2aee81a01.tar
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.gz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.bz2
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.lz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.xz
change-b02091f847b94e94db465469e723fcf2aee81a01.tar.zst
change-b02091f847b94e94db465469e723fcf2aee81a01.zip
Add file mode check in `unlink`
Diffstat (limited to 'src/change_log.cc')
-rw-r--r--src/change_log.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/change_log.cc b/src/change_log.cc
index 8ff1475..a9e485f 100644
--- a/src/change_log.cc
+++ b/src/change_log.cc
@@ -29,14 +29,14 @@ void init() {
}
void exit(int status) {
- __attribute__((__noreturn__)) void(*real_exit)(int) = nullptr;
+ __attribute__((__noreturn__)) void(*actual_exit)(int) = nullptr;
const void* symbol_address = dlsym(RTLD_NEXT, "exit");
- std::memcpy(&real_exit, &symbol_address, sizeof(symbol_address));
+ std::memcpy(&actual_exit, &symbol_address, sizeof(symbol_address));
logger->append("exit");
- real_exit(status);
+ actual_exit(status);
}
bool is_tracked_file(const std::string& file_name) {
@@ -78,7 +78,9 @@ int rmdir(const char* path) {
}
int unlink(const char* path) {
- logger->append("removed '" + std::string(path) + "'");
+ if ( io::is_regular_file(path) ) {
+ logger->append("rm '" + std::string(path) + "'");
+ }
return actual::unlink(path);
}