summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-05 00:52:30 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-05 00:52:49 +0200
commit27ca8d7a250915b290cf89c195e383a8abab35d5 (patch)
tree7b3bc82a9aa2ead56f56bb0f08f895666d77bde4 /src/socket.c
parent46018844bca3abf16ac38bdf0af8e48ee95d03f2 (diff)
socket: verify socket type properly when desrializing
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/socket.c b/src/socket.c
index 909151752c..19f1d22097 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1067,7 +1067,7 @@ static int socket_serialize(Unit *u, FILE *f, FDSet *fds) {
if ((r = socket_address_print(&p->address, &t)) < 0)
return r;
- unit_serialize_item_format(u, f, "socket", "%i %s", copy, t);
+ unit_serialize_item_format(u, f, "socket", "%i %i %s", copy, p->address.type, t);
free(t);
} else {
assert(p->type == SOCKET_FIFO);
@@ -1145,15 +1145,15 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
}
} else if (streq(key, "socket")) {
- int fd, skip = 0;
+ int fd, type, skip = 0;
SocketPort *p;
- if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
+ if (sscanf(value, "%i %i %n", &fd, &type, &skip) < 2 || fd < 0 || type < 0 || !fdset_contains(fds, fd))
log_debug("Failed to parse socket value %s", value);
else {
LIST_FOREACH(port, p, s->ports)
- if (socket_address_is(&p->address, value+skip))
+ if (socket_address_is(&p->address, value+skip, type))
break;
if (p) {