initial commit
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
diff -urN a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
|
||||
--- a/src/basic/mountpoint-util.c 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/basic/mountpoint-util.c 2026-03-29 15:01:10.720866440 -0500
|
||||
@@ -127,7 +127,7 @@
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- p = find_line_startswith(fdinfo, "mnt_id:");
|
||||
+ p = (char*) find_line_startswith(fdinfo, "mnt_id:");
|
||||
if (!p) /* The mnt_id field is a relatively new addition */
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@@ -554,7 +554,7 @@
|
||||
int dev_is_devtmpfs(void) {
|
||||
_cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
|
||||
int mount_id, r;
|
||||
- char *e;
|
||||
+ const char *e;
|
||||
|
||||
r = path_get_mnt_id("/dev", &mount_id);
|
||||
if (r < 0)
|
||||
diff -urN a/src/basic/process-util.c b/src/basic/process-util.c
|
||||
--- a/src/basic/process-util.c 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/basic/process-util.c 2026-03-29 15:01:10.721866471 -0500
|
||||
@@ -1793,7 +1793,7 @@
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- p = find_line_startswith(fdinfo, "Pid:");
|
||||
+ p = (char*) find_line_startswith(fdinfo, "Pid:");
|
||||
if (!p)
|
||||
return -ENOTTY; /* not a pidfd? */
|
||||
|
||||
diff -urN a/src/basic/string-util.c b/src/basic/string-util.c
|
||||
--- a/src/basic/string-util.c 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/basic/string-util.c 2026-03-29 15:01:10.720866440 -0500
|
||||
@@ -1409,8 +1409,8 @@
|
||||
return strndup(a, strcspn(a, reject));
|
||||
}
|
||||
|
||||
-char *find_line_startswith(const char *haystack, const char *needle) {
|
||||
- char *p;
|
||||
+const char *find_line_startswith(const char *haystack, const char *needle) {
|
||||
+ const char *p;
|
||||
|
||||
assert(haystack);
|
||||
assert(needle);
|
||||
diff -urN a/src/basic/string-util.h b/src/basic/string-util.h
|
||||
--- a/src/basic/string-util.h 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/basic/string-util.h 2026-03-29 15:01:10.720866440 -0500
|
||||
@@ -26,14 +26,14 @@
|
||||
#define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
|
||||
#define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
|
||||
|
||||
-static inline char* strstr_ptr(const char *haystack, const char *needle) {
|
||||
+static inline const char* strstr_ptr(const char *haystack, const char *needle) {
|
||||
if (!haystack || !needle)
|
||||
return NULL;
|
||||
return strstr(haystack, needle);
|
||||
}
|
||||
|
||||
-static inline char *strstrafter(const char *haystack, const char *needle) {
|
||||
- char *p;
|
||||
+static inline const char *strstrafter(const char *haystack, const char *needle) {
|
||||
+ const char *p;
|
||||
|
||||
/* Returns NULL if not found, or pointer to first character after needle if found */
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
#endif // 0
|
||||
char *strdupcspn(const char *a, const char *reject);
|
||||
|
||||
-char *find_line_startswith(const char *haystack, const char *needle);
|
||||
+const char *find_line_startswith(const char *haystack, const char *needle);
|
||||
|
||||
char *startswith_strv(const char *string, char **strv);
|
||||
|
||||
diff -urN a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c
|
||||
--- a/src/libelogind/sd-bus/sd-bus.c 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/libelogind/sd-bus/sd-bus.c 2026-03-29 14:55:42.302578511 -0500
|
||||
@@ -1407,7 +1407,8 @@
|
||||
|
||||
int bus_set_address_system_remote(sd_bus *b, const char *host) {
|
||||
_cleanup_free_ char *e = NULL;
|
||||
- char *m = NULL, *c = NULL, *a, *rbracket = NULL, *p = NULL;
|
||||
+ const char *m = NULL, *at = NULL, *rbracket = NULL, *p = NULL;
|
||||
+ char *a = NULL, *c = NULL;
|
||||
|
||||
assert(b);
|
||||
assert(host);
|
||||
@@ -1423,29 +1424,29 @@
|
||||
e = bus_address_escape(t);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
- } else if ((a = strchr(host, '@'))) {
|
||||
- if (*(a + 1) == '[') {
|
||||
+ } else if ((at = strchr(host, '@'))) {
|
||||
+ if (*(at + 1) == '[') {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
- rbracket = strchr(a + 1, ']');
|
||||
+ rbracket = strchr(at + 1, ']');
|
||||
if (!rbracket)
|
||||
return -EINVAL;
|
||||
t = new0(char, strlen(host));
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
- strncat(t, host, a - host + 1);
|
||||
- strncat(t, a + 2, rbracket - a - 2);
|
||||
+ strncat(t, host, at - host + 1);
|
||||
+ strncat(t, at + 2, rbracket - at - 2);
|
||||
e = bus_address_escape(t);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
- } else if (*(a + 1) == '\0' || strchr(a + 1, '@'))
|
||||
+ } else if (*(at + 1) == '\0' || strchr(at + 1, '@'))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Let's see if a port was given */
|
||||
m = strchr(rbracket ? rbracket + 1 : host, ':');
|
||||
if (m) {
|
||||
- char *t;
|
||||
+ const char *t;
|
||||
bool got_forward_slash = false;
|
||||
|
||||
p = m + 1;
|
||||
diff -urN a/src/test/test-id128.c b/src/test/test-id128.c
|
||||
--- a/src/test/test-id128.c 2025-11-18 01:14:12.000000000 -0600
|
||||
+++ b/src/test/test-id128.c 2026-03-29 15:05:01.649650821 -0500
|
||||
@@ -22,6 +22,18 @@
|
||||
#define UUID_WALDI "01020304-0506-0708-090a-0b0c0d0e0f10"
|
||||
#define STR_NULL "00000000000000000000000000000000"
|
||||
|
||||
+static bool id128_in_0(sd_id128_t id) {
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static bool id128_in_1(sd_id128_t id, sd_id128_t a) {
|
||||
+ return sd_id128_equal(id, a);
|
||||
+}
|
||||
+
|
||||
+static bool id128_in_2(sd_id128_t id, sd_id128_t a, sd_id128_t b) {
|
||||
+ return sd_id128_equal(id, a) || sd_id128_equal(id, b);
|
||||
+}
|
||||
+
|
||||
TEST(id128) {
|
||||
sd_id128_t id, id2;
|
||||
char t[SD_ID128_STRING_MAX], q[SD_ID128_UUID_STRING_MAX];
|
||||
@@ -33,13 +45,14 @@
|
||||
|
||||
assert_se(sd_id128_from_string(t, &id2) == 0);
|
||||
assert_se(sd_id128_equal(id, id2));
|
||||
- assert_se(sd_id128_in_set(id, id));
|
||||
- assert_se(sd_id128_in_set(id, id2));
|
||||
- assert_se(sd_id128_in_set(id, id2, id));
|
||||
- assert_se(sd_id128_in_set(id, ID128_WALDI, id));
|
||||
- assert_se(!sd_id128_in_set(id));
|
||||
- assert_se(!sd_id128_in_set(id, ID128_WALDI));
|
||||
- assert_se(!sd_id128_in_set(id, ID128_WALDI, ID128_WALDI));
|
||||
+ /* Work around a Clang 22 frontend crash on sd_id128_in_set() with union varargs in this test. */
|
||||
+ assert_se(id128_in_1(id, id));
|
||||
+ assert_se(id128_in_1(id, id2));
|
||||
+ assert_se(id128_in_2(id, id2, id));
|
||||
+ assert_se(id128_in_2(id, ID128_WALDI, id));
|
||||
+ assert_se(!id128_in_0(id));
|
||||
+ assert_se(!id128_in_1(id, ID128_WALDI));
|
||||
+ assert_se(!id128_in_2(id, ID128_WALDI, ID128_WALDI));
|
||||
|
||||
if (sd_booted() > 0 && sd_id128_get_machine(NULL) >= 0) {
|
||||
assert_se(sd_id128_get_machine(&id) == 0);
|
||||
Reference in New Issue
Block a user