aboutsummaryrefslogtreecommitdiffstats
path: root/main/logger.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-16 00:52:48 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-16 00:52:48 +0000
commit17a6611f6ed43e005889a3dee8284bf7ff4c0b52 (patch)
treeaf3290f7b561f66efd0a88829120c1221952876e /main/logger.c
parent1d39a98f74757c7748038246eda950406c1e2aa1 (diff)
Fix rotate strategy
(Closes issue #13086) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@131166 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/logger.c b/main/logger.c
index 18a864c0d..60a464adb 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -533,19 +533,19 @@ static int rotate_file(const char *filename)
for (which = 0; which < ARRAY_LEN(suffixes); which++) {
snprintf(new, sizeof(new), "%s.%d%s", filename, x, suffixes[which]);
fd = open(new, O_RDONLY);
- if (fd > -1)
+ if (fd > -1) {
close(fd);
- else {
found = 1;
break;
}
}
- if (!found)
+ if (!found) {
break;
+ }
}
/* Found an empty slot */
- for (y = x; y > -1; y--) {
+ for (y = x; y > 0; y--) {
for (which = 0; which < ARRAY_LEN(suffixes); which++) {
snprintf(old, sizeof(old), "%s.%d%s", filename, y - 1, suffixes[which]);
fd = open(old, O_RDONLY);