From 9aa935fdfc3d289fa84154743bfcd6f9f8467356 Mon Sep 17 00:00:00 2001 From: Daniil Ruban Date: Thu, 9 May 2024 07:05:25 +0200 Subject: [PATCH] Fixes error message on error in carrier file - Fix based on https://bugzilla.redhat.com/show_bug.cgi?id=1253797 - In short: If on read carrier file EINVAL happens - that's not an error, but shows that interface is disabled Change-Id: I92f660e6e214f3ba7d710fcf192952550a947bd8 Signed-off-by: Daniil Ruban --- src/network-monitor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/network-monitor.c b/src/network-monitor.c index 4d9b85c..d456335 100755 --- a/src/network-monitor.c +++ b/src/network-monitor.c @@ -60,10 +60,15 @@ int netconfig_ethernet_cable_plugin_status_check() errno = 0; rv = fscanf(fd, "%d", &ret); if (rv < 0) { - ERR("Error! Failed to read from file, rv:[%d], error:[%s]", - rv, strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); - fclose(fd); - return -1; + // EINVAL is not error -> https://bugzilla.redhat.com/show_bug.cgi?id=1253797 + if (errno == EINVAL) { + ret = 0; + } else { + ERR("Error! Failed to read from file, rv:[%d], error:[%s]", + rv, strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); + fclose(fd); + return -1; + } } if (ret == 1) { -- 2.34.1