aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c4
-rw-r--r--src/sysstdio.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 4c3d546962c..9301405943b 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2711,10 +2711,10 @@ emacs_perror (char const *message)
2711 ? initial_argv[0] : "emacs"); 2711 ? initial_argv[0] : "emacs");
2712 /* Write it out all at once, if it's short; this is less likely to 2712 /* Write it out all at once, if it's short; this is less likely to
2713 be interleaved with other output. */ 2713 be interleaved with other output. */
2714 char buf[BUFSIZ]; 2714 char buf[min (PIPE_BUF, MAX_ALLOCA)];
2715 int nbytes = snprintf (buf, sizeof buf, "%s: %s: %s\n", 2715 int nbytes = snprintf (buf, sizeof buf, "%s: %s: %s\n",
2716 command, message, error_string); 2716 command, message, error_string);
2717 if (0 <= nbytes && nbytes < BUFSIZ) 2717 if (0 <= nbytes && nbytes < sizeof buf)
2718 emacs_write (STDERR_FILENO, buf, nbytes); 2718 emacs_write (STDERR_FILENO, buf, nbytes);
2719 else 2719 else
2720 { 2720 {
diff --git a/src/sysstdio.h b/src/sysstdio.h
index 5303e8a15b2..637f5fdfa6d 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
21#define EMACS_SYSSTDIO_H 21#define EMACS_SYSSTDIO_H
22 22
23#include <fcntl.h> 23#include <fcntl.h>
24#include <limits.h>
24#include <stdio.h> 25#include <stdio.h>
25#include "unlocked-io.h" 26#include "unlocked-io.h"
26 27
@@ -38,4 +39,8 @@ extern void close_output_streams (void);
38# define FOPEN_TEXT "" 39# define FOPEN_TEXT ""
39#endif 40#endif
40 41
42#ifndef PIPE_BUF
43 #define PIPE_BUF MAX_ALLOCA
44#endif
45
41#endif /* EMACS_SYSSTDIO_H */ 46#endif /* EMACS_SYSSTDIO_H */