<commit_before>/*
 * libefiboot - library for the manipulation of EFI boot variables
 * Copyright 2012-2018 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

#include "fix_coverity.h"

#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <unistd.h>

#include "efiboot.h"

int HIDDEN
parse_acpi_hid_uid(struct device *dev, const char *fmt, ...)
{
        int rc;
        char *path = NULL;
        va_list ap;
        char *fbuf = NULL;
        uint16_t tmp16;
        uint32_t acpi_hid = 0;
        uint64_t acpi_uid_int = 0;

        debug("entry");

        va_start(ap, fmt);
        rc = vasprintfa(&path, fmt, ap);
        va_end(ap);
        debug("path:%s rc:%d", path, rc);
        if (rc < 0 || path == NULL)
                return -1;

        rc = read_sysfs_file(&fbuf, "%s/firmware_node/path", path);
        if (rc > 0) {
                size_t l = strlen(fbuf);
                if (l > 1) {
                        fbuf[l-1] = 0;
                        dev->acpi_root.acpi_cid_str = strdup(fbuf);
                        debug("Setting ACPI root path to \"%s\"", fbuf);
                }
        }
<commit_msg>Coverity still doesn't believe in error codes...<commit_after>/*
 * libefiboot - library for the manipulation of EFI boot variables
 * Copyright 2012-2018 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

#include "fix_coverity.h"

#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <unistd.h>

#include "efiboot.h"

int HIDDEN
parse_acpi_hid_uid(struct device *dev, const char *fmt, ...)
{
        int rc;
        char *path = NULL;
        va_list ap;
        char *fbuf = NULL;
        uint16_t tmp16;
        uint32_t acpi_hid = 0;
        uint64_t acpi_uid_int = 0;

        debug("entry");

        va_start(ap, fmt);
        rc = vasprintfa(&path, fmt, ap);
        va_end(ap);
        debug("path:%s rc:%d", path, rc);
        if (rc < 0 || path == NULL)
                return -1;

        rc = read_sysfs_file(&fbuf, "%s/firmware_node/path", path);
        if (rc > 0 && fbuf) {
                size_t l = strlen(fbuf);
                if (l > 1) {
                        fbuf[l-1] = 0;
                        dev->acpi_root.acpi_cid_str = strdup(fbuf);
                        debug("Setting ACPI root path to \"%s\"", fbuf);
                }
        }

{'fraction_non_alphanumeric': 0.10603990161246242, 'fraction_numerical': 0.014211533205793932, 'mean_word_length': 2.210526315789474, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6296431', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1114, 'n_words': 407}