summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2022-08-29 13:07:11 +0200
committerJan Janssen <medhefgo@web.de>2022-08-30 12:03:28 +0200
commitc0f86d66f3f6b561528e7f856f9926bec766c036 (patch)
treeb5b17ffb3a41a7974ff0ad35db009b4f8aa94116 /src/shared
parentMerge pull request #24474 from yuwata/udevadm-settle-cleanups (diff)
downloadsystemd-c0f86d66f3f6b561528e7f856f9926bec766c036.tar.xz
systemd-c0f86d66f3f6b561528e7f856f9926bec766c036.zip
tree-wide: Use correct format specifiers
gcc will complain about all these with -Wformat-signedness.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-unit-procs.c2
-rw-r--r--src/shared/cpu-set-util.c8
-rw-r--r--src/shared/json.c8
-rw-r--r--src/shared/mount-util.c4
-rw-r--r--src/shared/netif-sriov.c4
-rw-r--r--src/shared/watchdog.c2
6 files changed, 14 insertions, 14 deletions
diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
index 56d522a7d0..8b462b5627 100644
--- a/src/shared/bus-unit-procs.c
+++ b/src/shared/bus-unit-procs.c
@@ -378,7 +378,7 @@ int unit_show_processes(
if (r == -ENOMEM)
goto finish;
if (r < 0)
- log_warning_errno(r, "Invalid process description in GetUnitProcesses reply: cgroup=\"%s\" pid="PID_FMT" command=\"%s\", ignoring: %m",
+ log_warning_errno(r, "Invalid process description in GetUnitProcesses reply: cgroup=\"%s\" pid=%u command=\"%s\", ignoring: %m",
path, pid, name);
}
diff --git a/src/shared/cpu-set-util.c b/src/shared/cpu-set-util.c
index e3e69635a6..7edb673d97 100644
--- a/src/shared/cpu-set-util.c
+++ b/src/shared/cpu-set-util.c
@@ -62,9 +62,9 @@ char *cpu_set_to_range_string(const CPUSet *set) {
return NULL;
if (range_end > range_start)
- r = sprintf(str + len, len > 0 ? " %d-%d" : "%d-%d", range_start, range_end);
+ r = sprintf(str + len, len > 0 ? " %u-%u" : "%u-%u", range_start, range_end);
else
- r = sprintf(str + len, len > 0 ? " %d" : "%d", range_start);
+ r = sprintf(str + len, len > 0 ? " %u" : "%u", range_start);
assert_se(r > 0);
len += r;
}
@@ -74,9 +74,9 @@ char *cpu_set_to_range_string(const CPUSet *set) {
return NULL;
if (range_end > range_start)
- r = sprintf(str + len, len > 0 ? " %d-%d" : "%d-%d", range_start, range_end);
+ r = sprintf(str + len, len > 0 ? " %u-%u" : "%u-%u", range_start, range_end);
else
- r = sprintf(str + len, len > 0 ? " %d" : "%d", range_start);
+ r = sprintf(str + len, len > 0 ? " %u" : "%u", range_start);
assert_se(r > 0);
}
diff --git a/src/shared/json.c b/src/shared/json.c
index 67b6b75fa8..919f7f79db 100644
--- a/src/shared/json.c
+++ b/src/shared/json.c
@@ -904,7 +904,7 @@ int64_t json_variant_integer(JsonVariant *v) {
if (v->value.unsig <= INT64_MAX)
return (int64_t) v->value.unsig;
- log_debug("Unsigned integer %ju requested as signed integer and out of range, returning 0.", v->value.unsig);
+ log_debug("Unsigned integer %" PRIu64 " requested as signed integer and out of range, returning 0.", v->value.unsig);
return 0;
case JSON_VARIANT_REAL: {
@@ -946,7 +946,7 @@ uint64_t json_variant_unsigned(JsonVariant *v) {
if (v->value.integer >= 0)
return (uint64_t) v->value.integer;
- log_debug("Signed integer %ju requested as unsigned integer and out of range, returning 0.", v->value.integer);
+ log_debug("Signed integer %" PRIi64 " requested as unsigned integer and out of range, returning 0.", v->value.integer);
return 0;
case JSON_VARIANT_UNSIGNED:
@@ -996,7 +996,7 @@ double json_variant_real(JsonVariant *v) {
if ((int64_t) converted == v->value.integer)
return converted;
- log_debug("Signed integer %ji requested as real, and cannot be converted losslessly, returning 0.", v->value.integer);
+ log_debug("Signed integer %" PRIi64 " requested as real, and cannot be converted losslessly, returning 0.", v->value.integer);
return 0.0;
}
@@ -1006,7 +1006,7 @@ double json_variant_real(JsonVariant *v) {
if ((uint64_t) converted == v->value.unsig)
return converted;
- log_debug("Unsigned integer %ju requested as real, and cannot be converted losslessly, returning 0.", v->value.unsig);
+ log_debug("Unsigned integer %" PRIu64 " requested as real, and cannot be converted losslessly, returning 0.", v->value.unsig);
return 0.0;
}
diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
index a119a7c3c1..290bbec4df 100644
--- a/src/shared/mount-util.c
+++ b/src/shared/mount-util.c
@@ -1060,7 +1060,7 @@ static int make_userns(uid_t uid_shift, uid_t uid_range, RemountIdmapFlags flags
/* Allocates a userns file descriptor with the mapping we need. For this we'll fork off a child
* process whose only purpose is to give us a new user namespace. It's killed when we got it. */
- if (asprintf(&line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, uid_shift, uid_range) < 0)
+ if (asprintf(&line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0u, uid_shift, uid_range) < 0)
return log_oom_debug();
/* If requested we'll include an entry in the mapping so that the host root user can make changes to
@@ -1076,7 +1076,7 @@ static int make_userns(uid_t uid_shift, uid_t uid_range, RemountIdmapFlags flags
if (flags & REMOUNT_IDMAP_HOST_ROOT)
if (strextendf(&line,
UID_FMT " " UID_FMT " " UID_FMT "\n",
- UID_MAPPED_ROOT, 0, 1) < 0)
+ UID_MAPPED_ROOT, 0u, 1u) < 0)
return log_oom_debug();
/* We always assign the same UID and GID ranges */
diff --git a/src/shared/netif-sriov.c b/src/shared/netif-sriov.c
index 9edc174124..18e5f0eeb7 100644
--- a/src/shared/netif-sriov.c
+++ b/src/shared/netif-sriov.c
@@ -395,13 +395,13 @@ int config_parse_sr_iov_uint32(
if (streq(lvalue, "VLANId")) {
if (k == 0 || k > 4095) {
- log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV VLANId: %d", k);
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV VLANId: %u", k);
return 0;
}
sr_iov->vlan = k;
} else if (streq(lvalue, "VirtualFunction")) {
if (k >= INT_MAX) {
- log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV virtual function: %d", k);
+ log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV virtual function: %u", k);
return 0;
}
sr_iov->vf = k;
diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c
index 2476778c94..48186134aa 100644
--- a/src/shared/watchdog.c
+++ b/src/shared/watchdog.c
@@ -52,7 +52,7 @@ static int get_watchdog_sysfs_path(const char *filename, char **ret_path) {
if (!S_ISCHR(st.st_mode))
return -EBADF;
- if (asprintf(ret_path, "/sys/dev/char/%d:%d/%s", major(st.st_rdev), minor(st.st_rdev), filename) < 0)
+ if (asprintf(ret_path, "/sys/dev/char/%u:%u/%s", major(st.st_rdev), minor(st.st_rdev), filename) < 0)
return -ENOMEM;
return 0;