X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fnames-cache.c;h=65bfb85acbc5bf76e70bd5515b0fa08f9efc1b62;hb=7d23054d18402b1891343f090d3cd37d7e83c82f;hp=059311ac20ae6e3cfc8f7b60253409c6b7348516;hpb=90f8c88626289b0a713abc41759e8bebe6c20ddb;p=pciutils.git diff --git a/lib/names-cache.c b/lib/names-cache.c index 059311a..65bfb85 100644 --- a/lib/names-cache.c +++ b/lib/names-cache.c @@ -1,11 +1,18 @@ /* * The PCI Library -- ID to Name Cache * - * Copyright (c) 2008 Martin Mares + * Copyright (c) 2008--2009 Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "internal.h" +#include "names.h" + +#ifdef PCI_USE_DNS + #include #include #include @@ -14,11 +21,6 @@ #include #include -#include "internal.h" -#include "names.h" - -#ifdef PCI_USE_DNS - static const char cache_version[] = "#PCI-CACHE-1.0"; static char *get_cache_name(struct pci_access *a) @@ -38,8 +40,9 @@ static char *get_cache_name(struct pci_access *a) buf = pci_malloc(a, strlen(pw->pw_dir) + strlen(name+1) + 1); sprintf(buf, "%s%s", pw->pw_dir, name+1); - pci_set_param_internal(a, "net.cache_name", buf, 0); - return buf; + pci_set_param_internal(a, "net.cache_name", buf, 1); + pci_mfree(buf); + return pci_get_param(a, "net.cache_name"); } int