Change in libosmocore[master]: macaddr: fix osmo_macaddr_parse(): return meaningful error codes

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Aug 26 18:11:33 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19841 )


Change subject: macaddr: fix osmo_macaddr_parse(): return meaningful error codes
......................................................................

macaddr: fix osmo_macaddr_parse(): return meaningful error codes

Change-Id: I316deb83979198acc26721d29708d9942174b192
---
M src/macaddr.c
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/19841/1

diff --git a/src/macaddr.c b/src/macaddr.c
index a9138f8..56fdf86 100644
--- a/src/macaddr.c
+++ b/src/macaddr.c
@@ -34,6 +34,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
 
 /*! Parse a MAC address from human-readable notation
  *  This function parses an ethernet MAC address in the commonly-used
@@ -77,11 +78,11 @@
  */
 int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name)
 {
-	int rc = -1;
 	struct ifaddrs *ifa, *ifaddr;
+	int rc = -ENODEV;
 
 	if (getifaddrs(&ifaddr) != 0)
-		return -1;
+		return -errno;
 
 	for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
 		struct sockaddr_dl *sdl;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19841
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I316deb83979198acc26721d29708d9942174b192
Gerrit-Change-Number: 19841
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200826/243a9be8/attachment.htm>


More information about the gerrit-log mailing list