zdev: Use util_readlink() for consistent error handling

Avoid code duplication and inconsistent error handling by replacing
readlink() with util_readlink(), which is used project-wide to
standardize readlink() usage.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Polensky
2025-10-07 17:12:14 +02:00
committed by Jan Höppner
parent dd818ccc15
commit 8ad28f7856
7 changed files with 17 additions and 10 deletions

View File

@@ -13,6 +13,7 @@
#include <string.h>
#include <sys/stat.h>
#include "lib/util_libc.h"
#include "lib/util_path.h"
#include "attrib.h"
@@ -464,7 +465,7 @@ char *device_read_active_attrib(struct device *dev, const char *name)
value = misc_read_text_file(path, 1, err_ignore);
if (!value) {
/* Symbolic links count as read-only attributes. */
link = misc_readlink(path);
link = util_readlink(path);
if (link) {
value = misc_strdup(basename(link));
free(link);
@@ -560,7 +561,7 @@ void device_read_active_settings(struct device *dev, read_scope_t scope)
goto next;
/* Register symbolic links as readonly attributes. */
link = misc_readlink(path);
link = util_readlink(path);
if (!link)
goto next;