From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH] fixup! sandbox: implement actual sandbox reset via exec(2)
Date: Tue, 15 Sep 2020 07:21:43 +0200 [thread overview]
Message-ID: <20200915052143.894451-1-ahmad@a3f.at> (raw)
In-Reply-To: <20200914133748.5988-4-a.fatoum@pengutronix.de>
add_image modifies the argument passed to it, we want to reexec with
the original argv however, thus make a copy of the argument.
---
arch/sandbox/os/common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 778ac3d6e60f..d0addef5af49 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -247,10 +247,10 @@ extern void mem_malloc_init(void *start, void *end);
extern char * strsep_unescaped(char **s, const char *ct);
-static int add_image(char *str, char *devname_template, int *devname_number)
+static int add_image(const char *_str, char *devname_template, int *devname_number)
{
struct hf_info *hf = malloc(sizeof(struct hf_info));
- char *filename, *devname;
+ char *str, *filename, *devname;
char tmp[16];
int readonly = 0, cdev = 0, blkdev = 0;
struct stat s;
@@ -260,6 +260,8 @@ static int add_image(char *str, char *devname_template, int *devname_number)
if (!hf)
return -1;
+ str = strdup(_str);
+
filename = strsep_unescaped(&str, ",");
while ((opt = strsep_unescaped(&str, ","))) {
if (!strcmp(opt, "ro"))
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-09-15 5:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 13:37 [PATCH 1/5] lib: string: retire deprecated strtok() in favor of reentrant strsep() Ahmad Fatoum
2020-09-14 13:37 ` [PATCH 2/5] ls: don't print . and .. on recursive ls Ahmad Fatoum
2020-09-14 13:37 ` [PATCH 3/5] sandbox: implement simple, ^C-interruptible, restart handler Ahmad Fatoum
2020-09-14 13:37 ` [PATCH 4/5] sandbox: implement actual sandbox reset via exec(2) Ahmad Fatoum
2020-09-15 5:21 ` Ahmad Fatoum [this message]
2020-09-14 13:37 ` [PATCH 5/5] sandbox: hostfile: support registering images as barebox block devices Ahmad Fatoum
2020-09-15 7:26 ` [PATCH 1/5] lib: string: retire deprecated strtok() in favor of reentrant strsep() Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200915052143.894451-1-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox