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

systemd / systemd / 22980501960

11 Mar 2026 08:14PM UTC coverage: 72.513% (+0.1%) from 72.411%
22980501960

push

github

yuwata
hwdb/keyboard: fix Positron vendor location

Move lines without changing them.
Fixes: 9aad3336f ("hwdb/keyboard: Map FN key on Positron Proxima 15")
(https://github.com/systemd/systemd/pull/40929)

315785 of 435487 relevant lines covered (72.51%)

1194954.79 hits per line

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

65.85
/src/basic/device-nodes.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdio.h>
4
#include <string.h>
5
#include <sys/stat.h>
6

7
#include "device-nodes.h"
8
#include "path-util.h"
9
#include "stdio-util.h"
10
#include "string-util.h"
11
#include "utf8.h"
12

13
int allow_listed_char_for_devnode(char c, const char *additional) {
8,451,118✔
14
        return
8,451,118✔
15
                ascii_isdigit(c) ||
15,074,041✔
16
                ascii_isalpha(c) ||
6,622,923✔
17
                strchr("#+-.:=@_", c) ||
10,114,702✔
18
                (additional && strchr(additional, c));
425,381✔
19
}
20

21
int encode_devnode_name(const char *str, char *str_enc, size_t len) {
9,167✔
22
        size_t i, j;
9,167✔
23

24
        if (!str || !str_enc)
9,167✔
25
                return -EINVAL;
26

27
        for (i = 0, j = 0; str[i] != '\0'; i++) {
119,225✔
28
                int seqlen;
110,058✔
29

30
                seqlen = utf8_encoded_valid_unichar(str + i, SIZE_MAX);
110,058✔
31
                if (seqlen > 1) {
110,058✔
32

33
                        if (len-j < (size_t) seqlen)
4✔
34
                                return -EINVAL;
35

36
                        memcpy(&str_enc[j], &str[i], seqlen);
4✔
37
                        j += seqlen;
4✔
38
                        i += (seqlen-1);
4✔
39

40
                } else if (str[i] == '\\' || !allow_listed_char_for_devnode(str[i], NULL)) {
110,054✔
41

42
                        if (len-j < 5)
39,999✔
43
                                return -EINVAL;
44

45
                        assert_se(snprintf_ok(&str_enc[j], 5, "\\x%02x", (unsigned char) str[i]));
39,999✔
46
                        j += 4;
39,999✔
47

48
                } else {
49
                        if (len-j < 1)
70,055✔
50
                                return -EINVAL;
51

52
                        str_enc[j] = str[i];
70,055✔
53
                        j++;
70,055✔
54
                }
55
        }
56

57
        if (len-j < 1)
9,167✔
58
                return -EINVAL;
59

60
        str_enc[j] = '\0';
9,167✔
61
        return 0;
9,167✔
62
}
63

64
int devnode_same(const char *a, const char *b) {
×
65
        struct stat sa, sb;
×
66

67
        assert(a);
×
68
        assert(b);
×
69

70
        if (!valid_device_node_path(a) || !valid_device_node_path(b))
×
71
                return -EINVAL;
×
72

73
        if (stat(a, &sa) < 0)
×
74
                return -errno;
×
75
        if (stat(b, &sb) < 0)
×
76
                return -errno;
×
77

78
        if (!S_ISBLK(sa.st_mode) && !S_ISCHR(sa.st_mode))
×
79
                return -ENODEV;
80
        if (!S_ISBLK(sb.st_mode) && !S_ISCHR(sb.st_mode))
×
81
                return -ENODEV;
82

83
        if (((sa.st_mode ^ sb.st_mode) & S_IFMT) != 0) /* both inode same device node type? */
×
84
                return false;
85

86
        return sa.st_rdev == sb.st_rdev;
×
87
}
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