]> granicus.if.org Git - neomutt/commitdiff
fix coverity defects
authorRichard Russon <rich@flatcap.org>
Fri, 27 Apr 2018 01:14:52 +0000 (02:14 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 27 Apr 2018 01:14:52 +0000 (02:14 +0100)
browser.c
mutt/file.c

index e1e29b0947ef99634fe06f003c20680693855c66..64d3a1b5e7bd8f826243f85023d272880c43774e 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -2082,7 +2082,10 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           if (buffy)
             examine_mailboxes(menu, &state);
           else
-            examine_directory(menu, &state, NULL, NULL);
+          {
+            if (examine_directory(menu, &state, NULL, NULL) == -1)
+              break;
+          }
           init_menu(&state, menu, title, sizeof(title), buffy);
         }
         break;
index e76d97feee4e467d5f7a8c8013b444de9a726047..b3e69ab4b6c977f71141f8fef917ff7323e09ec9 100644 (file)
@@ -875,8 +875,11 @@ FILE *mutt_file_mkstemp_full(const char *file, int line, const char *func)
 
   FILE *fp = fdopen(fd, "w+");
 
-  if (unlink(name) && (errno != ENOENT))
+  if ((unlink(name) != 0) && (errno != ENOENT))
+  {
+    mutt_file_fclose(&fp);
     return NULL;
+  }
 
   MuttLogger(0, file, line, func, 1, "created temp file '%s'\n", name);
   return fp;
@@ -1102,7 +1105,6 @@ int mutt_file_lock(int fd, int excl, int timeout)
   int count;
   int attempt;
   struct stat sb = { 0 }, prev_sb = { 0 };
-  int r = 0;
 
   struct flock lck;
 
@@ -1141,14 +1143,7 @@ int mutt_file_lock(int fd, int excl, int timeout)
     sleep(1);
   }
 
-  /* release any other locks obtained in this routine */
-  if (r != 0)
-  {
-    lck.l_type = F_UNLCK;
-    fcntl(fd, F_SETLK, &lck);
-  }
-
-  return r;
+  return 0;
 }
 
 /**