From 0aba4997b5327add60a951f7c94951566005894e Mon Sep 17 00:00:00 2001 From: ABeltramo Date: Sun, 4 Feb 2024 15:48:15 +0000 Subject: [PATCH] fix: fake-udev use error code to signal fail on sending message --- src/fake-udev/fake-udev-cli.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fake-udev/fake-udev-cli.cpp b/src/fake-udev/fake-udev-cli.cpp index bc0382b2..acbc526a 100644 --- a/src/fake-udev/fake-udev-cli.cpp +++ b/src/fake-udev/fake-udev-cli.cpp @@ -7,6 +7,7 @@ constexpr int UDEV_EVENT_MODE = 2; int main(int argc, char *argv[]) { InputParser input(argc, argv); + int rc = -1; if (input.cmdOptionExists("-h") || input.cmdOptionExists("--help")) { std::cout << "Usage: fake-udev -m [options]" << std::endl; @@ -51,15 +52,16 @@ int main(int argc, char *argv[]) { netlink_connection conn{}; if (connect(conn, domain, type, protocol, groups)) { auto header = make_udev_header(msg, udev_subsystem, udev_devtype); - if (send_msgs(conn, {header, msg})) + if (send_msgs(conn, {header, msg})) { std::cout << "Message sent" << std::endl; + rc = 0; + } } cleanup(conn); - return 0; } else { std::cout << "No messages to send, have you forgot to pass -m ?" << std::endl; } - return -1; + return rc; } \ No newline at end of file