From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] added SAFE_SOCKETPAIR()
Date: Tue, 11 Dec 2018 21:08:03 +0100 [thread overview]
Message-ID: <20181211200803.GA23351@x230> (raw)
In-Reply-To: <515a2ca2-1f68-d2d1-524d-f4fc89be337d@google.com>
Hi Ramon,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> +++ b/lib/safe_net.c
> @@ -132,6 +132,34 @@ int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void),
> return rval;
> }
> +int safe_socketpair(const char *file, const int lineno, int domain, int type,
> + int protocol, int sv[])
> +{
> + int rval, ttype;
> +
> + rval = socketpair(domain, type, protocol, sv);
> +
> + if (rval < 0) {
> + switch (errno) {
> + case EPROTONOSUPPORT:
> + case ESOCKTNOSUPPORT:
> + case EOPNOTSUPP:
> + case EPFNOSUPPORT:
> + case EAFNOSUPPORT:
> + ttype = TCONF;
> + break;
> + default:
> + ttype = TBROK;
> + }
It looks like you copy paste errno's from safe_socket(). While it does not harm
to have more errno's, I guess these to never come: ESOCKTNOSUPPORT, EPFNOSUPPORT.
They're listed in safe_socket() as man socket(2) says "Other errors may be
generated by the underlying protocol modules.", it was needed to ad them.
Otherwise LGTM.
> +
> + tst_brkm(ttype | TERRNO, NULL,
> + "%s:%d: socketpair(%d, %d, %d, %p) failed",
> + file, lineno, domain, type, protocol, sv);
...
Kind regards,
Petr
next prev parent reply other threads:[~2018-12-11 20:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 22:58 [LTP] added SAFE_SOCKETPAIR() Ramon Pantin
2018-12-11 20:08 ` Petr Vorel [this message]
2019-01-15 19:13 ` Petr Vorel
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=20181211200803.GA23351@x230 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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