Skip to content
Snippets Groups Projects
Commit 65faf212 authored by Kamil Dudka's avatar Kamil Dudka
Browse files

make 'copy' and 'copytruncate' work together

This commit fixes a regression introduced
by 3b26f4d8.
parent 0894dd8e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1019,7 +1019,10 @@ static int copyTruncate(char *currLog, char *saveLog, struct stat *sb,
message(MESS_DEBUG, "copying %s to %s\n", currLog, saveLog);
 
if (!debug) {
if ((fdcurr = open(currLog, ((flags & LOG_FLAG_COPY) ? O_RDONLY : O_RDWR) | O_NOFOLLOW)) < 0) {
/* read access is sufficient for 'copy' but not for 'copytruncate' */
const int read_only = (flags & LOG_FLAG_COPY)
&& !(flags & LOG_FLAG_COPYTRUNCATE);
if ((fdcurr = open(currLog, ((read_only) ? O_RDONLY : O_RDWR) | O_NOFOLLOW)) < 0) {
message(MESS_ERROR, "error opening %s: %s\n", currLog,
strerror(errno));
return 1;
Loading
Loading
Loading
Loading
@@ -1842,6 +1842,19 @@ test.log.2.gz 1 zero
test.log.3.gz 1 first
EOF
 
cleanup 73
# ------------------------------- Test 73 ------------------------------------
# make sure that 'copy' and 'copytruncate' work together
preptest test.log 73 2
$RLR test-config.73 --force
checkoutput <<EOF
test.log 0
test.log.1 0 zero
EOF
cleanup 100
 
# ------------------------------- Test 100 ------------------------------------
Loading
Loading
&DIR&/test*.log {
copy
copytruncate
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment