]> code.delx.au - gnu-emacs/blobdiff - lib-src/pop.c
lib-src/emacsclient.c (w32_execvp): Declare execvp to silence the compiler.
[gnu-emacs] / lib-src / pop.c
index ae1000742cc1814d94f93f0e930d17924e7b8320..b8ed65c3eac0ffd85cb1bc454940ec27f2d985c4 100644 (file)
@@ -1,6 +1,6 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
 
-Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2011
+Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2012
   Free Software Foundation, Inc.
 
 Author: Jonathan Kamens <jik@security.ov.com>
@@ -21,11 +21,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#else
-#define MAIL_USE_POP
-#endif
 
 #ifdef MAIL_USE_POP
 
@@ -101,7 +97,7 @@ extern char *krb_realmofhost (/* char * */);
 #endif /* KERBEROS */
 
 #ifndef WINDOWSNT
-#if !defined (HAVE_H_ERRNO) || !defined (HAVE_CONFIG_H)
+#ifndef HAVE_H_ERRNO
 extern int h_errno;
 #endif
 #endif
@@ -346,6 +342,7 @@ pop_stat (popserver server, int *count, int *size)
       if (0 == strncmp (fromserver, "-ERR", 4))
        {
          strncpy (pop_error, fromserver, ERROR_MAX);
+         pop_error[ERROR_MAX-1] = '\0';
        }
       else
        {
@@ -447,7 +444,10 @@ pop_list (popserver server, int message, int **IDs, int **sizes)
       if (strncmp (fromserver, "+OK ", 4))
        {
          if (! strncmp (fromserver, "-ERR", 4))
-           strncpy (pop_error, fromserver, ERROR_MAX);
+           {
+             strncpy (pop_error, fromserver, ERROR_MAX);
+             pop_error[ERROR_MAX-1] = '\0';
+           }
          else
            {
              strcpy (pop_error,
@@ -687,6 +687,7 @@ pop_multi_first (popserver server, const char *command, char **response)
   if (0 == strncmp (*response, "-ERR", 4))
     {
       strncpy (pop_error, *response, ERROR_MAX);
+      pop_error[ERROR_MAX-1] = '\0';
       return (-1);
     }
   else if (0 == strncmp (*response, "+OK", 3))
@@ -860,6 +861,7 @@ pop_last (popserver server)
   if (! strncmp (fromserver, "-ERR", 4))
     {
       strncpy (pop_error, fromserver, ERROR_MAX);
+      pop_error[ERROR_MAX-1] = '\0';
       return (-1);
     }
   else if (strncmp (fromserver, "+OK ", 4))