• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 14895667988

07 May 2025 08:57PM UTC coverage: 72.225% (-0.007%) from 72.232%
14895667988

push

github

yuwata
network: log_link_message_debug_errno() automatically append %m if necessary

Follow-up for d28746ef5.
Fixes CID#1609753.

0 of 1 new or added line in 1 file covered. (0.0%)

20297 existing lines in 338 files now uncovered.

297407 of 411780 relevant lines covered (72.22%)

695716.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.54
/src/cryptsetup/cryptsetup-keyfile.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "alloc-util.h"
4
#include "cryptsetup-keyfile.h"
5
#include "fileio.h"
6
#include "log.h"
7
#include "path-util.h"
8
#include "string-util.h"
9
#include "strv.h"
10

11
int find_key_file(const char *key_file, char **search_path, const char *bindname, struct iovec *ret_key) {
24✔
12

13
        int r;
24✔
14

15
        assert(key_file);
24✔
16
        assert(ret_key);
24✔
17

18
        if (strv_isempty(search_path) || path_is_absolute(key_file)) {
48✔
19

UNCOV
20
                r = read_full_file_full(
×
21
                                AT_FDCWD, key_file, UINT64_MAX, SIZE_MAX,
22
                                READ_FULL_FILE_SECURE|READ_FULL_FILE_WARN_WORLD_READABLE|READ_FULL_FILE_CONNECT_SOCKET,
23
                                bindname,
24
                                (char**) &ret_key->iov_base, &ret_key->iov_len);
×
25
                if (r == -E2BIG)
×
26
                        return log_error_errno(r, "Key file '%s' too large.", key_file);
×
UNCOV
27
                if (r < 0)
×
UNCOV
28
                        return log_error_errno(r, "Failed to load key file '%s': %m", key_file);
×
29

30
                return 1;
31
        }
32

33
        STRV_FOREACH(i, search_path) {
71✔
34
                _cleanup_free_ char *joined = NULL;
48✔
35

36
                joined = path_join(*i, key_file);
48✔
37
                if (!joined)
48✔
UNCOV
38
                        return log_oom();
×
39

40
                r = read_full_file_full(
96✔
41
                                AT_FDCWD, joined, UINT64_MAX, SIZE_MAX,
42
                                READ_FULL_FILE_SECURE|READ_FULL_FILE_WARN_WORLD_READABLE|READ_FULL_FILE_CONNECT_SOCKET,
43
                                bindname,
44
                                (char**) &ret_key->iov_base, &ret_key->iov_len);
48✔
45
                if (r >= 0)
48✔
46
                        return 1;
47
                if (r == -E2BIG) {
47✔
UNCOV
48
                        log_warning_errno(r, "Key file '%s' too large, ignoring.", key_file);
×
UNCOV
49
                        continue;
×
50
                }
51
                if (r != -ENOENT)
47✔
UNCOV
52
                        return log_error_errno(r, "Failed to load key file '%s': %m", key_file);
×
53
        }
54

55
        /* Search path supplied, but file not found, report by returning NULL, but not failing */
56
        *ret_key = IOVEC_MAKE(NULL, 0);
23✔
57
        return 0;
23✔
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc