[systemd-commits] src/hostname src/libsystemd-bus src/timedate
Kay Sievers
kay at kemper.freedesktop.org
Mon Oct 21 18:35:49 PDT 2013
src/hostname/hostnamed.c | 6 +++---
src/libsystemd-bus/bus-message.c | 2 +-
src/libsystemd-bus/bus-util.c | 4 ++--
src/timedate/timedated.c | 12 ++++++------
4 files changed, 12 insertions(+), 12 deletions(-)
New commits:
commit 9bcbce4201afada1c0ad8ada0cbfbbf58a52a6a7
Author: Kay Sievers <kay at vrfy.org>
Date: Tue Oct 22 03:27:38 2013 +0200
bus: avoid 'bool' storage when retrieving 'b' from the message
Just use an unsigned int as a bool type to avoid issues in the public
message reading API; sizeof(bool) == 1, but the code copies 4 bytes at
the pointers destination.
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index db07621..0854bc4 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -371,7 +371,7 @@ static int method_set_hostname(sd_bus *bus, sd_bus_message *m, void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
Context *c = userdata;
const char *name;
- bool interactive;
+ unsigned interactive;
char *h;
int r;
@@ -421,7 +421,7 @@ static int method_set_static_hostname(sd_bus *bus, sd_bus_message *m, void *user
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
Context *c = userdata;
const char *name;
- bool interactive;
+ unsigned interactive;
int r;
r = sd_bus_message_read(m, "sb", &name, &interactive);
@@ -472,7 +472,7 @@ static int method_set_static_hostname(sd_bus *bus, sd_bus_message *m, void *user
static int set_machine_info(Context *c, sd_bus *bus, sd_bus_message *m, int prop, sd_bus_message_handler_t cb) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- bool interactive;
+ unsigned interactive;
const char *name;
int r;
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 511bdf5..cfc45a3 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -2741,7 +2741,7 @@ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
break;
case SD_BUS_TYPE_BOOLEAN:
- *(int*) p = !!*(uint32_t*) q;
+ *(unsigned*) p = !!*(uint32_t*) q;
break;
case SD_BUS_TYPE_INT16:
diff --git a/src/libsystemd-bus/bus-util.c b/src/libsystemd-bus/bus-util.c
index c726104..42374fe 100644
--- a/src/libsystemd-bus/bus-util.c
+++ b/src/libsystemd-bus/bus-util.c
@@ -148,7 +148,7 @@ int bus_verify_polkit(
#ifdef ENABLE_POLKIT
else {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- bool authorized = false, challenge = false;
+ unsigned authorized = false, challenge = false;
r = sd_bus_call_method(
bus,
@@ -267,7 +267,7 @@ int bus_verify_polkit_async(
#ifdef ENABLE_POLKIT
q = hashmap_remove(*registry, m);
if (q) {
- bool authorized, challenge;
+ unsigned authorized, challenge;
/* This is the second invocation of this function, and
* there's already a response from polkit, let's
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 2ead4b9..809c80b 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -45,8 +45,8 @@
typedef struct Context {
char *zone;
bool local_rtc;
- int can_ntp;
- int use_ntp;
+ unsigned can_ntp;
+ unsigned use_ntp;
Hashmap *polkit_registry;
} Context;
@@ -521,7 +521,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
Context *c = userdata;
const char *z;
- bool interactive;
+ unsigned interactive;
char *t;
int r;
@@ -585,7 +585,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata) {
static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- bool lrtc, fix_system, interactive;
+ unsigned lrtc, fix_system, interactive;
Context *c = userdata;
struct timespec ts;
int r;
@@ -669,7 +669,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata)
static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- bool relative, interactive;
+ unsigned relative, interactive;
Context *c = userdata;
int64_t utc;
struct timespec ts;
@@ -735,7 +735,7 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata) {
static int method_set_ntp(sd_bus *bus, sd_bus_message *m, void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- bool ntp, interactive;
+ unsigned ntp, interactive;
Context *c = userdata;
int r;
More information about the systemd-commits
mailing list