summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-18 02:35:16 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-18 12:38:32 +0200
commitca4e095ab9e970cb8fa472ae69ea1f0648041722 (patch)
treef52866c74ae50f3b996f164efaaa690513c96034 /src/libsystemd
parent0204152684188302e6c6232e50f30997fecb4ae3 (diff)
sd-rtnl: make string returned by sd_rtnl_message_read_string() const
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c6
-rw-r--r--src/libsystemd/sd-rtnl/test-rtnl.c13
2 files changed, 10 insertions, 9 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 4d1b6fb198..c0a38e148b 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -786,7 +786,7 @@ int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **d
return RTA_PAYLOAD(rta);
}
-int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, char **data) {
+int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, const char **data) {
int r;
void *attr_data;
@@ -800,7 +800,7 @@ int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, char **
else if (strnlen(attr_data, r) >= (size_t) r)
return -EIO;
- *data = (char *) attr_data;
+ *data = (const char *) attr_data;
return 0;
}
@@ -962,7 +962,7 @@ int sd_rtnl_message_enter_container(sd_rtnl_message *m, unsigned short type) {
return r;
} else if (nl_type->type == NLA_UNION) {
const NLTypeSystemUnion *type_system_union;
- char *key;
+ const char *key;
r = type_system_get_type_system_union(m->container_type_system[m->n_containers],
&type_system_union,
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
index e6ba08e076..cd81acae77 100644
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ b/src/libsystemd/sd-rtnl/test-rtnl.c
@@ -35,7 +35,7 @@ static void test_link_configure(sd_rtnl *rtnl, int ifindex) {
_cleanup_rtnl_message_unref_ sd_rtnl_message *message;
const char *mac = "98:fe:94:3f:c6:18", *name = "test";
unsigned int mtu = 1450, mtu_out;
- char *name_out;
+ const char *name_out;
struct ether_addr mac_out;
/* we'd really like to test NEWLINK, but let's not mess with the running kernel */
@@ -61,7 +61,7 @@ static void test_link_get(sd_rtnl *rtnl, int ifindex) {
sd_rtnl_message *m;
sd_rtnl_message *r;
unsigned int mtu = 1500;
- char *str_data;
+ const char *str_data;
uint8_t u8_data;
uint32_t u32_data;
struct ether_addr eth_data;
@@ -108,7 +108,7 @@ static void test_address_get(sd_rtnl *rtnl, int ifindex) {
sd_rtnl_message *r;
struct in_addr in_data;
struct ifa_cacheinfo cache;
- char *label;
+ const char *label;
assert_se(sd_rtnl_message_new_addr(rtnl, &m, RTM_GETADDR, ifindex, AF_INET) >= 0);
assert_se(m);
@@ -174,7 +174,8 @@ static void test_multiple(void) {
}
static int link_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
- char *ifname = userdata, *data;
+ char *ifname = userdata;
+ const char *data;
assert_se(rtnl);
assert_se(m);
@@ -277,7 +278,7 @@ static void test_container(void) {
_cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
uint16_t u16_data;
uint32_t u32_data;
- char *string_data;
+ const char *string_data;
assert_se(sd_rtnl_message_new_link(NULL, &m, RTM_NEWLINK, 0) >= 0);
@@ -355,7 +356,7 @@ int main(void) {
sd_rtnl *rtnl;
sd_rtnl_message *m;
sd_rtnl_message *r;
- char *string_data;
+ const char *string_data;
int if_loopback;
uint16_t type;