aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJoakim Verona2012-05-21 00:37:29 +0200
committerJoakim Verona2012-05-21 00:37:29 +0200
commit74f082445c1dd0c92d5bb187db0d50287e3a7bae (patch)
tree48e3d8fd9df3876665654eab9bcf96ec492a31e9 /lib-src
parent52862ad482e030e4d54cd7d6e250d76e59ee0554 (diff)
parent1b170bc63c2f3a3fbe6ba6996d5a015e82634909 (diff)
downloademacs-74f082445c1dd0c92d5bb187db0d50287e3a7bae.tar.gz
emacs-74f082445c1dd0c92d5bb187db0d50287e3a7bae.zip
upstream, fix conflicts
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog53
-rw-r--r--lib-src/Makefile.in16
-rw-r--r--lib-src/emacsclient.c84
-rw-r--r--lib-src/etags.c39
-rw-r--r--lib-src/make-docfile.c2
-rw-r--r--lib-src/pop.c8
6 files changed, 133 insertions, 69 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index ea5f5a26627..d0e9e5c525a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,56 @@
12012-05-18 Glenn Morris <rgm@gnu.org>
2
3 * Makefile.in (install): Ensure $bindir exists.
4
52012-05-17 Glenn Morris <rgm@gnu.org>
6
7 * Makefile.in (ns_appbindir): New, set by configure.
8
92012-05-12 Glenn Morris <rgm@gnu.org>
10
11 * Makefile.in (MKDIR_P): New, set by configure.
12 ($(DESTDIR)${archlibdir}): Use $MKDIR_P.
13
142012-05-10 Paul Eggert <eggert@cs.ucla.edu>
15
16 etags: pacify gcc -Wstack-protector on Ubuntu 12.04 x86
17 * etags.c: Include <stdarg.h>.
18 (error): Declare as printf-style, as that's what it really is.
19 All uses changed.
20 (add_regex): Use single char rather than array-of-one char.
21
222012-05-05 Jim Meyering <meyering@redhat.com>
23
24 * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
25 NUL-terminate the error buffer (Bug#11372).
26
272012-05-02 Juanma Barranquero <lekktu@gmail.com>
28
29 * emacsclient.c (min): Undef before redefining it.
30
312012-05-02 Jim Meyering <jim@meyering.net>
32
33 * emacsclient.c (send_to_emacs): Avoid invalid strcpy upon partial
34 send (Bug#11374).
35
362012-04-29 Andreas Schwab <schwab@linux-m68k.org>
37
38 * make-docfile.c (scan_lisp_file) [DEBUG]: Also skip if and
39 byte-code forms. (Bug#11380)
40
412012-04-20 Chong Yidong <cyd@gnu.org>
42
43 * emacsclient.c (decode_options): Move -t -n corner case handling
44 into server.el (Bug#11102).
45 (main): Send -tty to Emacs under more circumstances (Bug#8314).
46
472012-04-18 Paul Eggert <eggert@cs.ucla.edu>
48
49 configure: new option --enable-gcc-warnings (Bug#11207)
50 * Makefile.in (C_WARNINGS_SWITCH): Remove.
51 (WARN_CFLAGS, WERROR_CFLAGS): New macros.
52 (BASE_CFLAGS): Use new macros rather than old.
53
12012-04-16 Paul Eggert <eggert@cs.ucla.edu> 542012-04-16 Paul Eggert <eggert@cs.ucla.edu>
2 55
3 Assume less-ancient POSIX support. 56 Assume less-ancient POSIX support.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index cc1757e4e3b..fd423212c9f 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -36,14 +36,19 @@ configuration=@configuration@
36EXEEXT=@EXEEXT@ 36EXEEXT=@EXEEXT@
37C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ 37C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
38C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ 38C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
39C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
40PROFILING_CFLAGS = @PROFILING_CFLAGS@ 39PROFILING_CFLAGS = @PROFILING_CFLAGS@
40WARN_CFLAGS = @WARN_CFLAGS@
41WERROR_CFLAGS = @WERROR_CFLAGS@
41 42
42# Program name transformation. 43# Program name transformation.
43TRANSFORM = @program_transform_name@ 44TRANSFORM = @program_transform_name@
44 45
45# ==================== Where To Install Things ==================== 46# ==================== Where To Install Things ====================
46 47
48# Location to install Emacs.app under GNUstep / Mac OS X.
49# Later values may use this.
50ns_appbindir=@ns_appbindir@
51
47# The default location for installation. Everything is placed in 52# The default location for installation. Everything is placed in
48# subdirectories of this directory. The default values for many of 53# subdirectories of this directory. The default values for many of
49# the variables below are expressed in terms of this one, so you may 54# the variables below are expressed in terms of this one, so you may
@@ -105,6 +110,7 @@ INSTALL_DATA = @INSTALL_DATA@
105INSTALL_SCRIPT = @INSTALL_SCRIPT@ 110INSTALL_SCRIPT = @INSTALL_SCRIPT@
106# By default, we uphold the dignity of our programs. 111# By default, we uphold the dignity of our programs.
107INSTALL_STRIP = 112INSTALL_STRIP =
113MKDIR_P = @MKDIR_P@
108 114
109# ========================== Lists of Files =========================== 115# ========================== Lists of Files ===========================
110 116
@@ -167,7 +173,8 @@ LIBS_SYSTEM = @LIBS_SYSTEM@
167# Those files shared with other GNU utilities need HAVE_CONFIG_H 173# Those files shared with other GNU utilities need HAVE_CONFIG_H
168# defined before they know they can take advantage of the information 174# defined before they know they can take advantage of the information
169# in ../src/config.h. 175# in ../src/config.h.
170BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ 176BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
177 $(WARN_CFLAGS) $(WERROR_CFLAGS) \
171 -DHAVE_CONFIG_H -I. -I../src -I../lib \ 178 -DHAVE_CONFIG_H -I. -I../src -I../lib \
172 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib 179 -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
173 180
@@ -229,13 +236,13 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
229$(DESTDIR)${archlibdir}: all 236$(DESTDIR)${archlibdir}: all
230 @echo 237 @echo
231 @echo "Installing utilities run internally by Emacs." 238 @echo "Installing utilities run internally by Emacs."
232 umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${archlibdir} 239 umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
233 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \ 240 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
234 for file in ${UTILITIES}; do \ 241 for file in ${UTILITIES}; do \
235 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ 242 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
236 done ; \ 243 done ; \
237 fi 244 fi
238 umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${gamedir}; \ 245 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
239 touch $(DESTDIR)${gamedir}/snake-scores; \ 246 touch $(DESTDIR)${gamedir}/snake-scores; \
240 touch $(DESTDIR)${gamedir}/tetris-scores 247 touch $(DESTDIR)${gamedir}/tetris-scores
241 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ 248 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
@@ -252,6 +259,7 @@ $(DESTDIR)${archlibdir}: all
252install: $(DESTDIR)${archlibdir} 259install: $(DESTDIR)${archlibdir}
253 @echo 260 @echo
254 @echo "Installing utilities for users to run." 261 @echo "Installing utilities for users to run."
262 umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
255 for file in ${INSTALLABLES} ; do \ 263 for file in ${INSTALLABLES} ; do \
256 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 264 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
257 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \ 265 chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 05fd0f3515e..29504445407 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -119,6 +119,11 @@ char *(getcwd) (char *, size_t);
119# define IF_LINT(Code) /* empty */ 119# define IF_LINT(Code) /* empty */
120#endif 120#endif
121 121
122#ifdef min
123#undef min
124#endif
125#define min(x, y) (((x) < (y)) ? (x) : (y))
126
122 127
123/* Name used to invoke this program. */ 128/* Name used to invoke this program. */
124const char *progname; 129const char *progname;
@@ -638,32 +643,23 @@ decode_options (int argc, char **argv)
638 if (display && strlen (display) == 0) 643 if (display && strlen (display) == 0)
639 display = NULL; 644 display = NULL;
640 645
641#ifdef WINDOWSNT
642 /* Emacs on Windows does not support GUI and console frames in the same
643 instance. So, it makes sense to treat the -t and -c options as
644 equivalent, and open a new frame regardless of whether the running
645 instance is GUI or console. Ideally, we would only set tty = 1 when
646 the instance is running in a console, but alas we don't know that.
647 The simplest workaround is to always ask for a tty frame, and let
648 server.el check whether it makes sense. */
649 if (tty || !current_frame)
650 {
651 display = (const char *) ttyname (0); /* Arg is ignored. */
652 current_frame = 0;
653 tty = 1;
654 }
655#endif
656
657 /* If no display is available, new frames are tty frames. */ 646 /* If no display is available, new frames are tty frames. */
658 if (!current_frame && !display) 647 if (!current_frame && !display)
659 tty = 1; 648 tty = 1;
660 649
661 /* --no-wait implies --current-frame on ttys when there are file
662 arguments or expressions given. */
663 if (nowait && tty && argc - optind > 0)
664 current_frame = 1;
665
666#ifdef WINDOWSNT 650#ifdef WINDOWSNT
651 /* Emacs on Windows does not support graphical and text terminal
652 frames in the same instance. So, treat the -t and -c options as
653 equivalent, and open a new frame on the server's terminal.
654 Ideally, we would only set tty = 1 when the serve is running in a
655 console, but alas we don't know that. As a workaround, always
656 ask for a tty frame, and let server.el figure it out. */
657 if (!current_frame)
658 {
659 display = NULL;
660 tty = 1;
661 }
662
667 if (alternate_editor && alternate_editor[0] == '\0') 663 if (alternate_editor && alternate_editor[0] == '\0')
668 { 664 {
669 message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ 665 message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\
@@ -792,33 +788,35 @@ sock_err_message (const char *function_name)
792static void 788static void
793send_to_emacs (HSOCKET s, const char *data) 789send_to_emacs (HSOCKET s, const char *data)
794{ 790{
795 while (data) 791 size_t dlen;
792
793 if (!data)
794 return;
795
796 dlen = strlen (data);
797 while (*data)
796 { 798 {
797 size_t dlen = strlen (data); 799 size_t part = min (dlen, SEND_BUFFER_SIZE - sblen);
798 if (dlen + sblen >= SEND_BUFFER_SIZE) 800 memcpy (&send_buffer[sblen], data, part);
799 { 801 data += part;
800 int part = SEND_BUFFER_SIZE - sblen; 802 sblen += part;
801 strncpy (&send_buffer[sblen], data, part);
802 data += part;
803 sblen = SEND_BUFFER_SIZE;
804 }
805 else if (dlen)
806 {
807 strcpy (&send_buffer[sblen], data);
808 data = NULL;
809 sblen += dlen;
810 }
811 else
812 break;
813 803
814 if (sblen == SEND_BUFFER_SIZE 804 if (sblen == SEND_BUFFER_SIZE
815 || (sblen > 0 && send_buffer[sblen-1] == '\n')) 805 || (sblen > 0 && send_buffer[sblen-1] == '\n'))
816 { 806 {
817 int sent = send (s, send_buffer, sblen, 0); 807 int sent = send (s, send_buffer, sblen, 0);
808 if (sent < 0)
809 {
810 message (TRUE, "%s: failed to send %d bytes to socket: %s\n",
811 progname, sblen, strerror (errno));
812 fail ();
813 }
818 if (sent != sblen) 814 if (sent != sblen)
819 strcpy (send_buffer, &send_buffer[sent]); 815 memmove (send_buffer, &send_buffer[sent], sblen - sent);
820 sblen -= sent; 816 sblen -= sent;
821 } 817 }
818
819 dlen -= part;
822 } 820 }
823} 821}
824 822
@@ -1667,10 +1665,10 @@ main (int argc, char **argv)
1667 send_to_emacs (emacs_socket, " "); 1665 send_to_emacs (emacs_socket, " ");
1668 } 1666 }
1669 1667
1670 /* If using the current frame, send tty information to Emacs anyway. 1668 /* Unless we are certain we don't want to occupy the tty, send our
1671 In daemon mode, Emacs may need to occupy this tty if no other 1669 tty information to Emacs. For example, in daemon mode Emacs may
1672 frame is available. */ 1670 need to occupy this tty if no other frame is available. */
1673 if (tty || (current_frame && !eval)) 1671 if (!current_frame || !eval)
1674 { 1672 {
1675 const char *tty_type, *tty_name; 1673 const char *tty_type, *tty_name;
1676 1674
diff --git a/lib-src/etags.c b/lib-src/etags.c
index c88473ad525..ccf97a8357f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -158,6 +158,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
158# endif 158# endif
159#endif /* HAVE_UNISTD_H */ 159#endif /* HAVE_UNISTD_H */
160 160
161#include <stdarg.h>
161#include <stdlib.h> 162#include <stdlib.h>
162#include <string.h> 163#include <string.h>
163#include <stdio.h> 164#include <stdio.h>
@@ -380,7 +381,7 @@ static void get_tag (char *, char **);
380static void analyse_regex (char *); 381static void analyse_regex (char *);
381static void free_regexps (void); 382static void free_regexps (void);
382static void regex_tag_multiline (void); 383static void regex_tag_multiline (void);
383static void error (const char *, const char *); 384static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
384static void suggest_asking_for_help (void) NO_RETURN; 385static void suggest_asking_for_help (void) NO_RETURN;
385void fatal (const char *, const char *) NO_RETURN; 386void fatal (const char *, const char *) NO_RETURN;
386static void pfatal (const char *) NO_RETURN; 387static void pfatal (const char *) NO_RETURN;
@@ -1140,7 +1141,7 @@ main (int argc, char **argv)
1140 case 'o': 1141 case 'o':
1141 if (tagfile) 1142 if (tagfile)
1142 { 1143 {
1143 error ("-o option may only be given once.", (char *)NULL); 1144 error ("-o option may only be given once.");
1144 suggest_asking_for_help (); 1145 suggest_asking_for_help ();
1145 /* NOTREACHED */ 1146 /* NOTREACHED */
1146 } 1147 }
@@ -1224,7 +1225,7 @@ main (int argc, char **argv)
1224 1225
1225 if (nincluded_files == 0 && file_count == 0) 1226 if (nincluded_files == 0 && file_count == 0)
1226 { 1227 {
1227 error ("no input files specified.", (char *)NULL); 1228 error ("no input files specified.");
1228 suggest_asking_for_help (); 1229 suggest_asking_for_help ();
1229 /* NOTREACHED */ 1230 /* NOTREACHED */
1230 } 1231 }
@@ -1447,7 +1448,7 @@ get_language_from_langname (const char *name)
1447 language *lang; 1448 language *lang;
1448 1449
1449 if (name == NULL) 1450 if (name == NULL)
1450 error ("empty language name", (char *)NULL); 1451 error ("empty language name");
1451 else 1452 else
1452 { 1453 {
1453 for (lang = lang_names; lang->name != NULL; lang++) 1454 for (lang = lang_names; lang->name != NULL; lang++)
@@ -2233,7 +2234,7 @@ put_entries (register node *np)
2233 { 2234 {
2234 /* Ctags mode */ 2235 /* Ctags mode */
2235 if (np->name == NULL) 2236 if (np->name == NULL)
2236 error ("internal error: NULL name in ctags mode.", (char *)NULL); 2237 error ("internal error: NULL name in ctags mode.");
2237 2238
2238 if (cxref_style) 2239 if (cxref_style)
2239 { 2240 {
@@ -2773,7 +2774,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2773 case dignorerest: 2774 case dignorerest:
2774 return FALSE; 2775 return FALSE;
2775 default: 2776 default:
2776 error ("internal error: definedef value.", (char *)NULL); 2777 error ("internal error: definedef value.");
2777 } 2778 }
2778 2779
2779 /* 2780 /*
@@ -3061,7 +3062,7 @@ make_C_tag (int isfun)
3061 make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), 3062 make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""),
3062 token_name.len + 17, isfun, token.line, 3063 token_name.len + 17, isfun, token.line,
3063 token.offset+token.length+1, token.lineno, token.linepos); 3064 token.offset+token.length+1, token.lineno, token.linepos);
3064 error ("INVALID TOKEN", NULL); 3065 error ("INVALID TOKEN");
3065 } 3066 }
3066 3067
3067 token.valid = FALSE; 3068 token.valid = FALSE;
@@ -5706,7 +5707,7 @@ add_regex (char *regexp_pattern, language *lang)
5706{ 5707{
5707 static struct re_pattern_buffer zeropattern; 5708 static struct re_pattern_buffer zeropattern;
5708 char sep, *pat, *name, *modifiers; 5709 char sep, *pat, *name, *modifiers;
5709 char empty[] = ""; 5710 char empty = '\0';
5710 const char *err; 5711 const char *err;
5711 struct re_pattern_buffer *patbuf; 5712 struct re_pattern_buffer *patbuf;
5712 regexp *rp; 5713 regexp *rp;
@@ -5719,7 +5720,7 @@ add_regex (char *regexp_pattern, language *lang)
5719 5720
5720 if (strlen (regexp_pattern) < 3) 5721 if (strlen (regexp_pattern) < 3)
5721 { 5722 {
5722 error ("null regexp", (char *)NULL); 5723 error ("null regexp");
5723 return; 5724 return;
5724 } 5725 }
5725 sep = regexp_pattern[0]; 5726 sep = regexp_pattern[0];
@@ -5738,7 +5739,7 @@ add_regex (char *regexp_pattern, language *lang)
5738 if (modifiers == NULL) /* no terminating separator --> no name */ 5739 if (modifiers == NULL) /* no terminating separator --> no name */
5739 { 5740 {
5740 modifiers = name; 5741 modifiers = name;
5741 name = empty; 5742 name = &empty;
5742 } 5743 }
5743 else 5744 else
5744 modifiers += 1; /* skip separator */ 5745 modifiers += 1; /* skip separator */
@@ -5749,7 +5750,7 @@ add_regex (char *regexp_pattern, language *lang)
5749 { 5750 {
5750 case 'N': 5751 case 'N':
5751 if (modifiers == name) 5752 if (modifiers == name)
5752 error ("forcing explicit tag name but no name, ignoring", NULL); 5753 error ("forcing explicit tag name but no name, ignoring");
5753 force_explicit_name = TRUE; 5754 force_explicit_name = TRUE;
5754 break; 5755 break;
5755 case 'i': 5756 case 'i':
@@ -5763,12 +5764,7 @@ add_regex (char *regexp_pattern, language *lang)
5763 need_filebuf = TRUE; 5764 need_filebuf = TRUE;
5764 break; 5765 break;
5765 default: 5766 default:
5766 { 5767 error ("invalid regexp modifier `%c', ignoring", modifiers[0]);
5767 char wrongmod [2];
5768 wrongmod[0] = modifiers[0];
5769 wrongmod[1] = '\0';
5770 error ("invalid regexp modifier `%s', ignoring", wrongmod);
5771 }
5772 break; 5768 break;
5773 } 5769 }
5774 5770
@@ -6423,13 +6419,16 @@ suggest_asking_for_help (void)
6423 exit (EXIT_FAILURE); 6419 exit (EXIT_FAILURE);
6424} 6420}
6425 6421
6426/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 6422/* Output a diagnostic with printf-style FORMAT and args. */
6427static void 6423static void
6428error (const char *s1, const char *s2) 6424error (const char *format, ...)
6429{ 6425{
6426 va_list ap;
6427 va_start (ap, format);
6430 fprintf (stderr, "%s: ", progname); 6428 fprintf (stderr, "%s: ", progname);
6431 fprintf (stderr, s1, s2); 6429 vfprintf (stderr, format, ap);
6432 fprintf (stderr, "\n"); 6430 fprintf (stderr, "\n");
6431 va_end (ap);
6433} 6432}
6434 6433
6435/* Return a newly-allocated string whose contents 6434/* Return a newly-allocated string whose contents
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 3e79cae4f41..b33b13f34ce 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1361,7 +1361,7 @@ scan_lisp_file (const char *filename, const char *mode)
1361#ifdef DEBUG 1361#ifdef DEBUG
1362 else if (! strcmp (buffer, "if") 1362 else if (! strcmp (buffer, "if")
1363 || ! strcmp (buffer, "byte-code")) 1363 || ! strcmp (buffer, "byte-code"))
1364 ; 1364 continue;
1365#endif 1365#endif
1366 1366
1367 else 1367 else
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 37494d17a44..c4c7f2b4e2f 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -346,6 +346,7 @@ pop_stat (popserver server, int *count, int *size)
346 if (0 == strncmp (fromserver, "-ERR", 4)) 346 if (0 == strncmp (fromserver, "-ERR", 4))
347 { 347 {
348 strncpy (pop_error, fromserver, ERROR_MAX); 348 strncpy (pop_error, fromserver, ERROR_MAX);
349 pop_error[ERROR_MAX-1] = '\0';
349 } 350 }
350 else 351 else
351 { 352 {
@@ -447,7 +448,10 @@ pop_list (popserver server, int message, int **IDs, int **sizes)
447 if (strncmp (fromserver, "+OK ", 4)) 448 if (strncmp (fromserver, "+OK ", 4))
448 { 449 {
449 if (! strncmp (fromserver, "-ERR", 4)) 450 if (! strncmp (fromserver, "-ERR", 4))
450 strncpy (pop_error, fromserver, ERROR_MAX); 451 {
452 strncpy (pop_error, fromserver, ERROR_MAX);
453 pop_error[ERROR_MAX-1] = '\0';
454 }
451 else 455 else
452 { 456 {
453 strcpy (pop_error, 457 strcpy (pop_error,
@@ -687,6 +691,7 @@ pop_multi_first (popserver server, const char *command, char **response)
687 if (0 == strncmp (*response, "-ERR", 4)) 691 if (0 == strncmp (*response, "-ERR", 4))
688 { 692 {
689 strncpy (pop_error, *response, ERROR_MAX); 693 strncpy (pop_error, *response, ERROR_MAX);
694 pop_error[ERROR_MAX-1] = '\0';
690 return (-1); 695 return (-1);
691 } 696 }
692 else if (0 == strncmp (*response, "+OK", 3)) 697 else if (0 == strncmp (*response, "+OK", 3))
@@ -860,6 +865,7 @@ pop_last (popserver server)
860 if (! strncmp (fromserver, "-ERR", 4)) 865 if (! strncmp (fromserver, "-ERR", 4))
861 { 866 {
862 strncpy (pop_error, fromserver, ERROR_MAX); 867 strncpy (pop_error, fromserver, ERROR_MAX);
868 pop_error[ERROR_MAX-1] = '\0';
863 return (-1); 869 return (-1);
864 } 870 }
865 else if (strncmp (fromserver, "+OK ", 4)) 871 else if (strncmp (fromserver, "+OK ", 4))