a whole lot of size_t -> ssize_t.
[apps/madmutt.git] / mx.c
diff --git a/mx.c b/mx.c
index 5f18ac1..c5576d6 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -29,6 +29,9 @@
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 #include <lib-lib/debug.h>
+#include <lib-lib/url.h>
+
+#include <lib-sys/unix.h>
 
 #include <lib-mime/mime.h>
 
@@ -41,7 +44,6 @@
 #include "thread.h"
 #include "copy.h"
 #include "keymap.h"
-#include "url.h"
 #include "sidebar.h"
 #include "compress.h"
 
@@ -165,9 +167,9 @@ static int mx_get_idx (const char* path) {
 /* Args:
  *     excl            if excl != 0, request an exclusive lock
  *     dot             if dot != 0, try to dotlock the file
- *     timeout         should retry locking?
+ *     time_out        should retry locking?
  */
-int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
+int mx_lock_file (const char *path, int fd, int excl, int dot, int time_out)
 {
 #if defined (USE_FCNTL) || defined (USE_FLOCK)
   int count;
@@ -204,8 +206,8 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
-        && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
-      if (timeout)
+        && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+      if (time_out)
         mutt_error _("Timeout exceeded while attempting fcntl lock!");
 
       return (-1);
@@ -238,8 +240,8 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
-        && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
-      if (timeout)
+        && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+      if (time_out)
         mutt_error _("Timeout exceeded while attempting flock lock!");
 
       r = -1;
@@ -255,7 +257,7 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
 #ifdef USE_DOTLOCK
   if (r == 0 && dot)
-    r = dotlock_file (path, fd, timeout);
+    r = dotlock_file (path, fd, time_out);
 #endif /* USE_DOTLOCK */
 
   if (r == -1) {