]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
portability to non-glibc: don't use realpath(..., NULL)
authorJim Meyering <meyering@redhat.com>
Tue, 26 Jan 2010 16:13:45 +0000 (17:13 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 27 Jan 2010 12:39:46 +0000 (13:39 +0100)
it causes a NULL-dereference on some systems like Solaris 10.
* src/node_device/node_device_linux_sysfs.c. Include <stdlib.h>.
(get_sriov_function): Use canonicalize_file_name, not realpath.
* bootstrap (modules): Add canonicalize-lgpl.

bootstrap
src/node_device/node_device_linux_sysfs.c

index aec5d055039690bd0bf78611413e59a480abe6db..cc3c6ef39259ce35e4b035b9b27df9f6369e81bb 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -68,6 +68,7 @@ modules='
 areadlink
 base64
 c-ctype
+canonicalize-lgpl
 close
 connect
 getaddrinfo
index 33e658d87a14f320401b083be4ae1b4d7eb5b695..c1fce5d15eccc12786f1f68b208805272024f992 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <fcntl.h>
 #include <sys/stat.h>
+#include <stdlib.h>
 
 #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,