From b74aadb3e5f845452afb764c79bfddd94d00a8d8 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 26 Jan 2010 17:13:45 +0100 Subject: [PATCH] portability to non-glibc: don't use realpath(..., NULL) it causes a NULL-dereference on some systems like Solaris 10. * src/node_device/node_device_linux_sysfs.c. Include . (get_sriov_function): Use canonicalize_file_name, not realpath. * bootstrap (modules): Add canonicalize-lgpl. --- bootstrap | 1 + src/node_device/node_device_linux_sysfs.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index aec5d05503..cc3c6ef392 100755 --- a/bootstrap +++ b/bootstrap @@ -68,6 +68,7 @@ modules=' areadlink base64 c-ctype +canonicalize-lgpl close connect getaddrinfo diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c index 33e658d87a..c1fce5d15e 100644 --- a/src/node_device/node_device_linux_sysfs.c +++ b/src/node_device/node_device_linux_sysfs.c @@ -24,6 +24,7 @@ #include #include +#include #include "node_device_driver.h" #include "node_device_hal.h" @@ -242,7 +243,8 @@ out: static int get_sriov_function(const char *device_link, struct pci_config_address **bdf) { - char *device_path = NULL, *config_address = NULL; + char *config_address = NULL; + char *device_path = NULL; char errbuf[64]; int ret = SRIOV_ERROR; @@ -259,7 +261,7 @@ static int get_sriov_function(const char *device_link, } - device_path = realpath(device_link, device_path); + device_path = canonicalize_file_name (device_link); if (device_path == NULL) { memset(errbuf, '\0', sizeof(errbuf)); VIR_ERROR("Failed to resolve device link '%s': '%s'", device_link, -- 2.47.2