From: Denis Kirjanov <kirjanov@gmail.com>
To: stephen@networkplumber.org, dsahern@kernel.org
Cc: netdev@vger.kernel.org, Denis Kirjanov <kirjanov@gmail.com>
Subject: [PATCH iproute] iplink: emit the error message if open_fds_add failed
Date: Tue, 21 Jan 2025 17:16:42 +0300 [thread overview]
Message-ID: <20250121141642.28899-1-kirjanov@gmail.com> (raw)
open_fds_add may fail since it adds an open fd
to the fixed array. Print the error message in
the such case.
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
ip/iplink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 59e8caf4..1396da23 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -666,7 +666,9 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
if (netns < 0)
invarg("Invalid \"netns\" value\n", *argv);
- open_fds_add(netns);
+ if (open_fds_add(netns))
+ invarg("No descriptors left\n", *argv);
+
addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_FD,
&netns, 4);
move_netns = true;
--
2.43.0
next reply other threads:[~2025-01-21 14:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 14:16 Denis Kirjanov [this message]
2025-01-26 16:58 ` [PATCH iproute] iplink: emit the error message if open_fds_add failed Stephen Hemminger
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=20250121141642.28899-1-kirjanov@gmail.com \
--to=kirjanov@gmail.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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