diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2019-12-23 15:47:21 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2020-01-03 15:42:13 +0000 |
commit | 12d17dcc26d908d1d675657936c7d036af7e39aa (patch) | |
tree | 1a4101f322e9417092d64f503e98c3239e307187 /tests/virpcimock.c | |
parent | f5e9bdb87feed6834977ee9813405206d26fcad0 (diff) | |
download | libvirt-12d17dcc26d908d1d675657936c7d036af7e39aa.tar.gz |
src: replace last_component() with g_path_get_basename()
The last_component() method is a GNULIB custom function
that returns a pointer to the base name in the path.
This is similar to g_path_get_basename() but without the
malloc. The extra malloc is no trouble for libvirt's
needs so we can use g_path_get_basename().
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/virpcimock.c')
-rw-r--r-- | tests/virpcimock.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 6048118d5c..92b6f810d8 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -28,7 +28,6 @@ # include "viralloc.h" # include "virstring.h" # include "virfile.h" -# include "dirname.h" static int (*real_access)(const char *path, int mode); static int (*real_open)(const char *path, int flags, ...); @@ -884,7 +883,7 @@ static int pci_driver_handle_change(int fd G_GNUC_UNUSED, const char *path) { int ret; - const char *file = last_component(path); + g_autofree char *file = g_path_get_basename(path); if (STREQ(file, "bind")) ret = pci_driver_handle_bind(path); |