]> granicus.if.org Git - mutt/commitdiff
backout c1371176ea45
authorMichael Elkins <me@sigpipe.org>
Thu, 11 Apr 2013 02:17:41 +0000 (02:17 +0000)
committerMichael Elkins <me@sigpipe.org>
Thu, 11 Apr 2013 02:17:41 +0000 (02:17 +0000)
browser.c
enter.c
imap/message.c
init.c
mbox.c
muttlib.c
mx.c
pop.c
query.c
smime.c
system.c

index 3d69b9d4491eb171eab61684fc91cb0e8080830a..cda4900a32d556c93a481213f92e24a1844216bd 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -615,11 +615,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
       }
       else
       {
-       if (getcwd (LastDir, sizeof (LastDir)) == NULL)
-       {
-         dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
-         LastDir[0] = '\0';
-       }
+       getcwd (LastDir, sizeof (LastDir));
        safe_strcat (LastDir, sizeof (LastDir), "/");
        safe_strncat (LastDir, sizeof (LastDir), f, i);
       }
@@ -629,13 +625,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
       if (f[0] == '/')
        strcpy (LastDir, "/");          /* __STRCPY_CHECKED__ */
       else
-      {
-       if (getcwd (LastDir, sizeof (LastDir)) == NULL)
-       {
-         dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
-         LastDir[0] = '\0';
-       }
-      }
+       getcwd (LastDir, sizeof (LastDir));
     }
 
     if (i <= 0 && f[0] != '/')
@@ -650,13 +640,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
   else 
   {
     if (!folder)
-    {
-      if (getcwd (LastDir, sizeof (LastDir)) == NULL)
-      {
-       dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
-       LastDir[0] = '\0';
-      }
-    }
+      getcwd (LastDir, sizeof (LastDir));
     else if (!LastDir[0])
       strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir));
     
@@ -675,13 +659,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
       while (i && LastDir[--i] == '/')
         LastDir[i] = '\0';
       if (!LastDir[0])
-      {
-        if (getcwd (LastDir, sizeof (LastDir)) == NULL)
-       {
-         dprint(1, (debugfile, "%s:%d getcwd() returned NULL\n", __FILE__, __LINE__));
-         LastDir[0] = '\0';
-       }
-      }
+        getcwd (LastDir, sizeof (LastDir));
     }
   }
 
diff --git a/enter.c b/enter.c
index 71214104bb8476f406518915774919b20ae13333..077c1e63a60d85f9eb60601bd2e287c6bcbda39a 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -28,7 +28,6 @@
 #include "history.h"
 
 #include <string.h>
-#include <errno.h>
 
 /* redraw flags for mutt_enter_string() */
 enum
@@ -95,8 +94,7 @@ static void my_wcstombs (char *dest, size_t dlen, const wchar_t *src, size_t sle
 
   /* If this works, we can stop now */
   if (dlen >= MB_LEN_MAX) {
-    if (wcrtomb (dest, 0, &st) == (size_t) -1)
-      dprint(1, (debugfile, "%s:%d wcrtomb() returned -1, errno=%d\n", __FILE__, __LINE__, errno));
+    wcrtomb (dest, 0, &st);
     return;
   }
 
index 0b81a706576894eb9ce8bf483c73482ce4ec78cf..742ac8cf19116ac1e72b66f8c6af5671e2fb314d 100644 (file)
@@ -561,13 +561,11 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
   }
 
   h->lines = 0;
-  if (fgets (buf, sizeof (buf), msg->fp) == NULL)
-      ; /* EOF checked below */
+  fgets (buf, sizeof (buf), msg->fp);
   while (!feof (msg->fp))
   {
     h->lines++;
-    if (fgets (buf, sizeof (buf), msg->fp) == NULL)
-       ; /* EOF checked in while loop condition */
+    fgets (buf, sizeof (buf), msg->fp);
   }
 
   h->content->length = ftell (msg->fp) - h->content->offset;
diff --git a/init.c b/init.c
index 0cc362b75d37cca0eb5eed1ca0de04e48e07cb50..a3ec23258ab39ba9fb0e61e4ca47f6693e293a55 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2822,6 +2822,7 @@ int mutt_getvaluebyname (const char *name, const struct mapping_t *map)
 #ifdef DEBUG
 static void start_debug (void)
 {
+  time_t t;
   int i;
   char buf[_POSIX_PATH_MAX];
   char buf2[_POSIX_PATH_MAX];
@@ -2835,6 +2836,7 @@ static void start_debug (void)
   }
   if ((debugfile = safe_fopen(buf, "w")) != NULL)
   {
+    t = time (0);
     setbuf (debugfile, NULL); /* don't buffer the debugging output! */
     dprint(1,(debugfile,"Mutt/%s (%s) debugging at level %d\n",
              MUTT_VERSION, ReleaseDate, debuglevel));
diff --git a/mbox.c b/mbox.c
index e69870d4f5a415677cebe8fc751cc1bc8b7045e0..2af4dd22a0be8972925e65ce817efffaede7e8d9 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -968,11 +968,7 @@ int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
     if (i == 0)
     {
       ctx->size = ftello (ctx->fp); /* update the size of the mailbox */
-      if (ftruncate (fileno (ctx->fp), ctx->size) == -1)
-      {
-       dprint(1, (debugfile, "%s:%d ftrunctate() returned -1, errno=%d\n", __FILE__, __LINE__, errno));
-       i = -1;
-      }
+      ftruncate (fileno (ctx->fp), ctx->size);
     }
   }
 
index 62fedd842459753ff0642aa5a7a63f3984dabf6d..7e93a3a27391bff28aa7dfdaaf96ba181b32f37a 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -67,7 +67,6 @@ void mutt_adv_mktemp (char *s, size_t l)
   char buf[_POSIX_PATH_MAX];
   char tmp[_POSIX_PATH_MAX];
   char *period;
-  char *r;
   size_t sl;
   struct stat sb;
   
@@ -76,9 +75,7 @@ void mutt_adv_mktemp (char *s, size_t l)
   if (s[0] == '\0')
   {
     snprintf (s, l, "%s/muttXXXXXX", buf);
-    r = mktemp (s);
-    if (*r == '\0')
-      dprint (1, (debugfile, "%s:%d mktemp returned an empty string (errno=%d)\n", __FILE__, __LINE__, errno));
+    mktemp (s);
   }
   else
   {
@@ -90,9 +87,7 @@ void mutt_adv_mktemp (char *s, size_t l)
     if ((period = strrchr (tmp, '.')) != NULL)
       *period = 0;
     snprintf (s, l, "%s/%s.XXXXXX", buf, tmp);
-    r = mktemp (s);
-    if (*r == '\0')
-      dprint (1, (debugfile, "%s:%d mktemp returned an empty string (errno=%d)\n", __FILE__, __LINE__, errno));
+    mktemp (s);
     if (period != NULL)
     {
       *period = '.';
diff --git a/mx.c b/mx.c
index 5d15cc59984d588deec9b38beca9577278113a20..7e5271429a0f40f789c4ec2b02e18cecd4a6c704 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -379,7 +379,6 @@ int mx_get_magic (const char *path)
   }
   else if (st.st_size == 0)
   {
-zero_size_file:
     /* hard to tell what zero-length files are, so assume the default magic */
     if (DefaultMagic == M_MBOX || DefaultMagic == M_MMDF)
       return (DefaultMagic);
@@ -390,12 +389,7 @@ zero_size_file:
   {
     struct utimbuf times;
 
-    if (fgets (tmp, sizeof (tmp), f) == NULL)
-    {
-      /* This situation should not occur since we check for size==0 above.. */
-      dprint(1, (debugfile, "%s:%d fgets() returned NULL.  this should not happen!\n", __FILE__, __LINE__));
-      goto zero_size_file;
-    }
+    fgets (tmp, sizeof (tmp), f);
     if (mutt_strncmp ("From ", tmp, 5) == 0)
       magic = M_MBOX;
     else if (mutt_strcmp (MMDF_SEP, tmp) == 0)
diff --git a/pop.c b/pop.c
index e0ebd34ff9458299944dfd647c9c08f802ea74ec..90d95b907609b1fa1d8f38adb3863915f5e4bc40 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -67,7 +67,6 @@ static int pop_read_header (POP_DATA *pop_data, HEADER *h)
   long length;
   char buf[LONG_STRING];
   char tempfile[_POSIX_PATH_MAX];
-  int rv;
 
   mutt_mktemp (tempfile, sizeof (tempfile));
   if (!(f = safe_fopen (tempfile, "w+")))
@@ -80,8 +79,7 @@ static int pop_read_header (POP_DATA *pop_data, HEADER *h)
   ret = pop_query (pop_data, buf, sizeof (buf));
   if (ret == 0)
   {
-    if ((rv = sscanf (buf, "+OK %d %ld", &index, &length)) < 2)
-      dprint(1, (debugfile, "%s:%d sscanf() returned %d\n", __FILE__, __LINE__, rv));
+    sscanf (buf, "+OK %d %ld", &index, &length);
 
     snprintf (buf, sizeof (buf), "TOP %d 0\r\n", h->refno);
     ret = pop_fetch_data (pop_data, buf, NULL, fetch_message, f);
@@ -112,21 +110,12 @@ static int pop_read_header (POP_DATA *pop_data, HEADER *h)
     {
       rewind (f);
       h->env = mutt_read_rfc822_header (f, h, 0, 0);
-      /*
-       * The following code seems to be trying to alter the content length by
-       * removing the CR characters for the header.  Note that this value is
-       * still incorrect, since "TOP 0" only returns the message header, so it
-       * only ends up accounting for the CR characters in the header.  The
-       * correct length is set when the entire message is downloaded by
-       * pop_fetch_message().
-       */
       h->content->length = length - h->content->offset + 1;
       rewind (f);
       while (!feof (f))
       {
        h->content->length--;
-       if (fgets (buf, sizeof (buf), f) == NULL)
-         ; /* EOF checked in while loop condition */
+       fgets (buf, sizeof (buf), f);
       }
       break;
     }
@@ -649,13 +638,11 @@ int pop_fetch_message (MESSAGE* msg, CONTEXT* ctx, int msgno)
 
   h->data = uidl;
   h->lines = 0;
-  if (fgets (buf, sizeof (buf), msg->fp) == NULL)
-    ; /* EOF checked in following while loop condition */
+  fgets (buf, sizeof (buf), msg->fp);
   while (!feof (msg->fp))
   {
     ctx->hdrs[msgno]->lines++;
-    if (fgets (buf, sizeof (buf), msg->fp) == NULL)
-      ; /* EOF checked in following while loop condition */
+    fgets (buf, sizeof (buf), msg->fp);
   }
 
   h->content->length = ftello (msg->fp) - h->content->offset;
diff --git a/query.c b/query.c
index d6c8d1c90f8cd4adfd4147b73ecfb654dda6d98d..b3b8f08b649aaeca681a9083eb8230f677f7aab2 100644 (file)
--- a/query.c
+++ b/query.c
@@ -93,12 +93,7 @@ static QUERY *run_query (char *s, int quiet)
   }
   if (!quiet)
     mutt_message _("Waiting for response...");
-  if (fgets (msg, sizeof (msg), fp) == NULL)
-  {
-    dprint(1, (debugfile, "%s:%d query_command produced no output (fgets() returned NULL)\n", __FILE__, __LINE__));
-    return 0;
-  }
-
+  fgets (msg, sizeof (msg), fp);
   if ((p = strrchr (msg, '\n')))
     *p = '\0';
   while ((buf = mutt_read_line (buf, &buflen, fp, &dummy, 0)) != NULL)
diff --git a/smime.c b/smime.c
index 7995d08b7172f82f1dfb65d6008c7a527a0c5f5c..2ee7b4a1a5c9f70ea2ef06082ec11db5821ce61a 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -391,24 +391,8 @@ char* smime_ask_for_key (char *prompt, char *mailbox, short public)
     while (!feof(index)) {
         numFields = fscanf (index, MUTT_FORMAT(STRING) " %x.%i " MUTT_FORMAT(STRING), fields[0], &hash,
           &hash_suffix, fields[2]);
-       /*
-        * ensure good values for these fields since they may not be set if
-        * `public` is false, and they are used below.
-        */
-       fields[3][0] = '\0';
-       fields[4][0] = '\0';
         if (public)
-       {
-         /*
-          * The original code here did not check the return value of fscanf,
-          * so I'm unsure whether the entire line should be ignored upon
-          * error.  Just log it for now.
-          */
-         int rv;
-          rv = fscanf (index, MUTT_FORMAT(STRING) " " MUTT_FORMAT(STRING) "\n", fields[3], fields[4]);
-         if (rv < 2)
-          dprint (1, (debugfile, "%s:%d fscanf() returned %d\n", __FILE__, __LINE__, errno));
-       }
+          fscanf (index, MUTT_FORMAT(STRING) " " MUTT_FORMAT(STRING) "\n", fields[3], fields[4]);
   
       /* 0=email 1=name 2=nick 3=intermediate 4=trust */
       if (numFields < 2) continue;
index 79766e55fca41cbf8435ba6c6bcf5afb72d5525e..5b4586548c4fc19e07831babf4e0df8559242894 100644 (file)
--- a/system.c
+++ b/system.c
@@ -92,8 +92,7 @@ int _mutt_system (const char *cmd, int flags)
          close (1);
          close (2);
 #endif
-         if (chdir ("/") == -1)
-           _exit (127);
+         chdir ("/");
          act.sa_handler = SIG_DFL;
          sigaction (SIGCHLD, &act, NULL);
          break;