From: Mike Frysinger <vapier@gentoo.org>
To: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Use a shell command as a socket for gdbserver
Date: Mon, 04 May 2015 07:44:00 -0000 [thread overview]
Message-ID: <20150504074434.GE30924@vapier> (raw)
In-Reply-To: <1430606377-16456-1-git-send-email-gabriel.corona@enst-bretagne.fr>
[-- Attachment #1: Type: text/plain, Size: 963 bytes --]
On 03 May 2015 00:39, Gabriel Corona wrote:
> +static int open_shell_command(char* command)
const, and the * should be next to "command", not "char"
> + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets);
space before the "(" -- this comes up a lot in your patch
> + else if (child == 0)
> + {
> + if (close (sockets[0]) < 0)
> + exit (1);
> + if (dup2 (sockets[1], 0) < 0 || dup2 (sockets[1], 1) < 0)
> + exit (1);
why not use error() instead of exit(1) ?
shouldn't you close sockets[1] after the dup2 ?
> + res = fork ();
> + if (res < 0)
> + exit (1);
> + if (res != 0)
> + exit (0);
the double fork could use a comment
> + {
> + signal (SIGPIPE, SIG_IGN);
> + while ((pid = waitpid (child, NULL, 0)) < 0 && errno == EINTR);
> + if (pid < 0)
> + error ("Could not wait for child.");
> + close (sockets[1]);
> + return sockets[0];
shouldn't this close sockets[1] before anything else ?
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-05-04 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-02 22:40 Gabriel Corona
2015-05-04 7:44 ` Mike Frysinger [this message]
2015-05-04 9:11 ` Gabriel Corona
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=20150504074434.GE30924@vapier \
--to=vapier@gentoo.org \
--cc=gabriel.corona@enst-bretagne.fr \
--cc=gdb-patches@sourceware.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