summaryrefslogtreecommitdiffhomepage
path: root/src/exec.c
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-17 19:23:30 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-17 19:23:30 -0600
commit8cd69a66db5d002d41544b7297229522ed61728d (patch)
tree69d71540edb46790ba89cc21a4be8cf282913e43 /src/exec.c
parent14d40b17a0720544a501ce31578bd3dbc8ce707c (diff)
downloadzash-8cd69a66db5d002d41544b7297229522ed61728d.tar.gz
fix issues with z/os build, header visibility, signals
Diffstat (limited to 'src/exec.c')
-rw-r--r--src/exec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/exec.c b/src/exec.c
index 15007fb..8243d3b 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -27,6 +27,12 @@
#include "parser.h"
#include "sys.h"
+/* POSIX may leave PIPE_BUF undefined when the limit varies by file (z/OS
+ does); _POSIX_PIPE_BUF is the guaranteed minimum. */
+#ifndef PIPE_BUF
+#define PIPE_BUF _POSIX_PIPE_BUF
+#endif
+
/**
* @brief A `break`, `continue` or `return` is in progress.
*/
@@ -287,7 +293,8 @@ static char **zos_environ(char **envp, const char *name, bool foreground) {
const char *base = strrchr(name, '/');
base = base ? base + 1 : name;
char *text = arena_alloc(&scratch, sizeof "_BPX_JOBNAME=" + 8);
- char *p = stpcpy(text, "_BPX_JOBNAME=");
+ memcpy(text, "_BPX_JOBNAME=", sizeof "_BPX_JOBNAME=" - 1);
+ char *p = text + sizeof "_BPX_JOBNAME=" - 1; /* no stpcpy on z/OS */
char *start = p;
for (; *base && p - start < 8; base++) {
char c = (char)toupper((unsigned char)*base);