fix usage of access()

those were the wrong constants.
This commit is contained in:
Enno Rehling 2014-03-15 14:36:55 -07:00
parent 2996f32e00
commit 8db8dbeefd
1 changed files with 3 additions and 3 deletions

View File

@ -75,17 +75,17 @@ cp_convert(const char *format, char *buffer, size_t length, int codepage)
void log_rotate(const char *filename, int maxindex)
{
int n;
if (_access(filename, _A_RDONLY)==0) {
if (_access(filename, 4)==0) {
char buffer[2][MAX_PATH];
int src = 1;
assert(strlen(filename)<sizeof(buffer[0])-4);
for(n=0;n<maxindex;++n) {
sprintf(buffer[0], "%s.%d", filename, n);
if (_access(filename, _A_RDONLY)!=0) {
if (_access(filename, 0)!=0) {
break;
}
}
if (_access(buffer[0], _A_RDONLY)==0) {
if (_access(buffer[0], 0)==0) {
unlink(buffer[0]);
}
while(n--) {