summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-08-27 13:11:25 +0000
committerSebastien Helleu <flashcode@flashtux.org>2007-08-27 13:11:25 +0000
commit7f1335c6f017768ba7c766cba5e164dce31e3ef9 (patch)
tree8979e7803429749a8d3cbf6f370de59a7edc9813
parentb0490eb249ee999dc5cf89898925d3e7271c278b (diff)
downloadweechat-7f1335c6f017768ba7c766cba5e164dce31e3ef9.zip
Fixed bug with flock() when home is on NFS filesystem (bug #20913)
-rw-r--r--ChangeLog1
-rw-r--r--src/common/log.c14
-rw-r--r--weechat/ChangeLog1
-rw-r--r--weechat/src/common/log.c14
4 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index fe3c5ed58..7c1867198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ ChangeLog - 2007-08-27
Version 0.2.6 (under dev!):
+ * fixed bug with flock() when home is on NFS filesystem (bug #20913)
* added option to align text of messages (except first lines) (task #7246)
* fixed user modes in nicklist when ban and nick mode are received in the
same MODE message (bug #20870)
diff --git a/src/common/log.c b/src/common/log.c
index 8d2ffad5e..2132e67a8 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
+#include <errno.h>
#ifdef HAVE_FLOCK
#include <sys/file.h>
@@ -79,11 +80,14 @@ weechat_log_open (char *filename, char *mode)
#ifdef HAVE_FLOCK
if ((flock (fileno (weechat_log_file), LOCK_EX | LOCK_NB) != 0))
{
- fclose (weechat_log_file);
- weechat_log_file = NULL;
- free (weechat_log_filename);
- weechat_log_filename = NULL;
- return 0;
+ if (errno == EWOULDBLOCK)
+ {
+ fclose (weechat_log_file);
+ weechat_log_file = NULL;
+ free (weechat_log_filename);
+ weechat_log_filename = NULL;
+ return 0;
+ }
}
#endif
diff --git a/weechat/ChangeLog b/weechat/ChangeLog
index fe3c5ed58..7c1867198 100644
--- a/weechat/ChangeLog
+++ b/weechat/ChangeLog
@@ -5,6 +5,7 @@ ChangeLog - 2007-08-27
Version 0.2.6 (under dev!):
+ * fixed bug with flock() when home is on NFS filesystem (bug #20913)
* added option to align text of messages (except first lines) (task #7246)
* fixed user modes in nicklist when ban and nick mode are received in the
same MODE message (bug #20870)
diff --git a/weechat/src/common/log.c b/weechat/src/common/log.c
index 8d2ffad5e..2132e67a8 100644
--- a/weechat/src/common/log.c
+++ b/weechat/src/common/log.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
+#include <errno.h>
#ifdef HAVE_FLOCK
#include <sys/file.h>
@@ -79,11 +80,14 @@ weechat_log_open (char *filename, char *mode)
#ifdef HAVE_FLOCK
if ((flock (fileno (weechat_log_file), LOCK_EX | LOCK_NB) != 0))
{
- fclose (weechat_log_file);
- weechat_log_file = NULL;
- free (weechat_log_filename);
- weechat_log_filename = NULL;
- return 0;
+ if (errno == EWOULDBLOCK)
+ {
+ fclose (weechat_log_file);
+ weechat_log_file = NULL;
+ free (weechat_log_filename);
+ weechat_log_filename = NULL;
+ return 0;
+ }
}
#endif