mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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 <stdlib.h>. (get_sriov_function): Use canonicalize_file_name, not realpath. * bootstrap (modules): Add canonicalize-lgpl.
This commit is contained in:
parent
950176ec65
commit
b74aadb3e5
@ -68,6 +68,7 @@ modules='
|
|||||||
areadlink
|
areadlink
|
||||||
base64
|
base64
|
||||||
c-ctype
|
c-ctype
|
||||||
|
canonicalize-lgpl
|
||||||
close
|
close
|
||||||
connect
|
connect
|
||||||
getaddrinfo
|
getaddrinfo
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "node_device_driver.h"
|
#include "node_device_driver.h"
|
||||||
#include "node_device_hal.h"
|
#include "node_device_hal.h"
|
||||||
@ -242,7 +243,8 @@ out:
|
|||||||
static int get_sriov_function(const char *device_link,
|
static int get_sriov_function(const char *device_link,
|
||||||
struct pci_config_address **bdf)
|
struct pci_config_address **bdf)
|
||||||
{
|
{
|
||||||
char *device_path = NULL, *config_address = NULL;
|
char *config_address = NULL;
|
||||||
|
char *device_path = NULL;
|
||||||
char errbuf[64];
|
char errbuf[64];
|
||||||
int ret = SRIOV_ERROR;
|
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) {
|
if (device_path == NULL) {
|
||||||
memset(errbuf, '\0', sizeof(errbuf));
|
memset(errbuf, '\0', sizeof(errbuf));
|
||||||
VIR_ERROR("Failed to resolve device link '%s': '%s'", device_link,
|
VIR_ERROR("Failed to resolve device link '%s': '%s'", device_link,
|
||||||
|
Loading…
Reference in New Issue
Block a user