From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sandbox:master commit in: src/
Date: Fri, 11 Sep 2015 07:53:27 +0000 (UTC) [thread overview]
Message-ID: <1361768237.d6af3ad271c3893419962059092eea29ffb4f507.vapier@gentoo> (raw)
commit: d6af3ad271c3893419962059092eea29ffb4f507
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 25 04:57:17 2013 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Feb 25 04:57:17 2013 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=d6af3ad2
sandbox: do not resolve target of stderr
The recent e12fee192ac8b0343a468e5a8f7811a7b029ff9a commit does not
handle things when stderr is connected to a real file (e.g. a pipe
or a socket or fifo or ...). It also does not play well to have
multiple things writing to the same file through different fds.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
src/sandbox.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/sandbox.c b/src/sandbox.c
index 51f2d95..3783bca 100644
--- a/src/sandbox.c
+++ b/src/sandbox.c
@@ -82,15 +82,18 @@ static int setup_sandbox(struct sandbox_info_t *sandbox_info, bool interactive)
}
/* Generate sandbox message path -- this process's stderr */
- char path[SB_PATH_MAX];
- sprintf(path, "%s/2", sb_get_fd_dir());
- if (realpath(path, sandbox_info->sandbox_message_path) == NULL) {
- sb_pwarn("could not read stderr path: %s", path);
+ const char *fdpath = sb_get_fd_dir();
+ if (realpath(fdpath, sandbox_info->sandbox_message_path) == NULL) {
+ sb_pwarn("could not read fd path: %s", fdpath);
if (realpath(sbio_fallback_path, sandbox_info->sandbox_message_path)) {
sb_pwarn("could not read stderr path: %s", sbio_fallback_path);
/* fuck it */
strcpy(sandbox_info->sandbox_message_path, sbio_fallback_path);
}
+ } else {
+ /* Do not resolve the target of stderr because it could be something
+ * that doesn't exist on the fs. Like a pipe (`tee` and such). */
+ strcat(sandbox_info->sandbox_message_path, "/2");
}
return 0;
next reply other threads:[~2015-09-11 7:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 7:53 Mike Frysinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-11 7:53 [gentoo-commits] proj/sandbox:master commit in: src/ Mike Frysinger
2016-03-29 12:24 Mike Frysinger
2021-10-28 9:56 Mike Frysinger
2021-10-29 5:37 Mike Frysinger
2021-11-01 18:31 Mike Frysinger
2021-11-02 4:28 Mike Frysinger
2021-11-02 4:28 Mike Frysinger
2021-11-03 4:55 Mike Frysinger
2021-11-05 10:25 Mike Frysinger
2021-11-05 10:25 Mike Frysinger
2023-08-05 23:38 Mike Gilbert
2023-08-05 23:38 Mike Gilbert
2023-08-08 15:30 Mike Gilbert
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=1361768237.d6af3ad271c3893419962059092eea29ffb4f507.vapier@gentoo \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.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