[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] Fix assignment of read-only location error OS/2
From: |
KO Myung-Hun |
Subject: |
[PATCH 2/2] Fix assignment of read-only location error OS/2 |
Date: |
Wed, 9 Nov 2022 22:45:52 +0900 |
-----
gcc -DHAVE_CONFIG_H -Isrc -I./src -Ilib -I./lib
-DLIBDIR=\"/usr/local/lib\" -DLOCALEDIR=\"/usr/local/share/locale\"
-D__ST_MT_ERRNO__ -O2 -Zomf -Zmt -MT src/job.o -MD -MP -MF $depbase.Tpo -c -o
src/job.o src/job.c &&\
mv -f $depbase.Tpo $depbase.Po
src/job.c: In function 'construct_command_argv_internal':
src/job.c:3229:21: error: assignment of read-only location '*shellflags'
3229 | shellflags[0] = '/'; /* "/c" */
| ^
-----
---
src/job.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/job.c b/src/job.c
index b78f279..22b4a82 100644
--- a/src/job.c
+++ b/src/job.c
@@ -3226,7 +3226,13 @@ construct_command_argv_internal (char *line, char
**restp, const char *shell,
# ifdef __EMX__ /* is this necessary? */
if (!unixy_shell && shellflags)
- shellflags[0] = '/'; /* "/c" */
+ {
+ int n = strlen (shellflags) + 1;
+ char *flags = alloca (n);
+ memcpy (flags, shellflags, n);
+ flags[0] = '/'; /* "/c" */
+ shellflags = flags;
+ }
# endif
/* In .ONESHELL mode we are allowed to throw the entire current
--
2.30.0