]> xenbits.xensource.com Git - libvirt.git/commitdiff
nss: remove use for virFile helper APIs
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 30 Jul 2019 14:33:20 +0000 (15:33 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 7 Aug 2019 15:54:02 +0000 (16:54 +0100)
Use the plain libc APIs to avoid a dependancy on the main libvirt
code from the nss module.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
cfg.mk
tools/nss/libvirt_nss.c

diff --git a/cfg.mk b/cfg.mk
index f2b326ec94f7b007a4f237914a907019dc7f14bd..f4cd215abc6fbb1d15b917e50f9d512f4c6c8e1e 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -1223,7 +1223,7 @@ exclude_file_name_regexp--sc_prohibit_access_xok = \
        ^(cfg\.mk|src/util/virutil\.c)$$
 
 exclude_file_name_regexp--sc_prohibit_asprintf = \
-  ^(cfg\.mk|bootstrap.conf$$|examples/|src/util/virstring\.[ch]$$|tests/vircgroupmock\.c|tools/virt-login-shell\.c$$)
+  ^(cfg\.mk|bootstrap.conf$$|examples/|src/util/virstring\.[ch]$$|tests/vircgroupmock\.c|tools/virt-login-shell\.c|tools/nss/libvirt_nss\.c$$)
 
 exclude_file_name_regexp--sc_prohibit_strdup = \
   ^(docs/|examples/|src/util/virstring\.c|tests/vir(netserverclient|cgroup)mock.c|tests/commandhelper\.c$$)
index d057827ebc4e7d7749694dd75b55440329f15fbf..ed2ad956e9c4b7f5c58e7805f887263d336eb47c 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "virlease.h"
 #include "viralloc.h"
-#include "virfile.h"
 #include "virtime.h"
 #include "virerror.h"
 #include "virsocketaddr.h"
@@ -304,7 +303,7 @@ findLease(const char *name,
         size_t dlen = strlen(entry->d_name);
 
         if (dlen >= 7 && STREQ(entry->d_name + dlen - 7, ".status")) {
-            if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
+            if (asprintf(&path, "%s/%s", leaseDir, entry->d_name) < 0)
                 goto cleanup;
 
             DEBUG("Processing %s", path);
@@ -315,7 +314,7 @@ findLease(const char *name,
             }
             VIR_FREE(path);
         } else if (dlen >= 5 && STREQ(entry->d_name + dlen - 5, ".macs")) {
-            if (!(path = virFileBuildPath(leaseDir, entry->d_name, NULL)))
+            if (asprintf(&path, "%s/%s", leaseDir, entry->d_name) < 0)
                 goto cleanup;
 
             if (VIR_REALLOC_N_QUIET(macmaps, nMacmaps + 1) < 0) {