summaryrefslogtreecommitdiff
path: root/src/core/dbus-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/dbus-service.c')
-rw-r--r--src/core/dbus-service.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 0904cc09c0..0eb336cf03 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -55,7 +55,7 @@ static int property_get_exit_status_set(
return r;
SET_FOREACH(id, status_set->status, i) {
- int val = PTR_TO_INT(id);
+ int32_t val = PTR_TO_INT(id);
if (val < 0 || val > 255)
continue;
@@ -74,10 +74,10 @@ static int property_get_exit_status_set(
return r;
SET_FOREACH(id, status_set->signal, i) {
- int val = PTR_TO_INT(id);
+ int32_t val = PTR_TO_INT(id);
const char *str;
- str = signal_to_string(val);
+ str = signal_to_string((int) val);
if (!str)
continue;
@@ -151,7 +151,7 @@ static int bus_set_transient_exit_status(
UnitWriteFlags flags,
sd_bus_error *error) {
- const int *status, *signal;
+ const int32_t *status, *signal;
size_t sz_status, sz_signal, i;
int r;
@@ -171,6 +171,9 @@ static int bus_set_transient_exit_status(
if (r < 0)
return r;
+ sz_status /= sizeof(int32_t);
+ sz_signal /= sizeof(int32_t);
+
if (sz_status == 0 && sz_signal == 0 && !UNIT_WRITE_FLAGS_NOOP(flags)) {
exit_status_set_free(status_set);
unit_write_settingf(u, flags, name, "%s=", name);
@@ -179,34 +182,34 @@ static int bus_set_transient_exit_status(
for (i = 0; i < sz_status; i++) {
if (status[i] < 0 || status[i] > 255)
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid status code in %s: %i", name, status[i]);
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid status code in %s: %"PRIi32, name, status[i]);
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
r = set_ensure_allocated(&status_set->status, NULL);
if (r < 0)
return r;
- r = set_put(status_set->status, INT_TO_PTR(status[i]));
+ r = set_put(status_set->status, INT_TO_PTR((int) status[i]));
if (r < 0)
return r;
- unit_write_settingf(u, flags, name, "%s=%i", name, status[i]);
+ unit_write_settingf(u, flags, name, "%s=%"PRIi32, name, status[i]);
}
}
for (i = 0; i < sz_signal; i++) {
const char *str;
- str = signal_to_string(signal[i]);
+ str = signal_to_string((int) signal[i]);
if (!str)
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal in %s: %i", name, signal[i]);
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal in %s: %"PRIi32, name, signal[i]);
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
r = set_ensure_allocated(&status_set->signal, NULL);
if (r < 0)
return r;
- r = set_put(status_set->signal, INT_TO_PTR(signal[i]));
+ r = set_put(status_set->signal, INT_TO_PTR((int) signal[i]));
if (r < 0)
return r;