shared/output.c: workaround FreeBSD's file locking issue (bb#1918)

0.96
Tomasz Kojm 15 years ago
parent 4542f1cd9c
commit 74f0e79e70
  1. 4
      ChangeLog
  2. 21
      shared/output.c

@ -1,3 +1,7 @@
Wed May 5 21:28:04 CEST 2010 (tk)
----------------------------------
* shared/output.c: workaround FreeBSD's file locking issue (bb#1918)
Wed May 5 14:12:46 CEST 2010 (tk)
----------------------------------
* freshclam/notify.c: fix warning message (bb#1972)

@ -297,14 +297,21 @@ int logg(const char *str, ...)
memset(&fl, 0, sizeof(fl));
fl.l_type = F_WRLCK;
if(fcntl(fileno(logg_fp), F_SETLK, &fl) == -1) {
#ifdef CL_THREAD_SAFE
pthread_mutex_unlock(&logg_mutex);
#ifdef EOPNOTSUPP
if(errno == EOPNOTSUPP)
printf("WARNING: File locking not supported (NFS?)\n");
else
#endif
printf("ERROR: %s is locked by another process\n", logg_file);
if(len > sizeof(buffer))
free(abuffer);
return -1;
}
{
#ifdef CL_THREAD_SAFE
pthread_mutex_unlock(&logg_mutex);
#endif
printf("ERROR: %s is locked by another process\n", logg_file);
if(len > sizeof(buffer))
free(abuffer);
return -1;
}
}
}
#endif
}

Loading…
Cancel
Save