diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-06-17 22:55:53 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-06-17 22:55:53 +0200 |
commit | 5925dd3c7ab771c86036b4a91640957e5d7a0e80 (patch) | |
tree | 2ecee71e040fdb11dfcdf331190df062f32a28c7 /src/socket.c | |
parent | 08bfb8106b3a337ebf9a4bf3a8ddd2e494d18b48 (diff) |
service: rework PID parsing logic everywhere
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/socket.c b/src/socket.c index 1852fe9375..874cc91697 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1047,7 +1047,7 @@ static int socket_serialize(Unit *u, FILE *f, FDSet *fds) { unit_serialize_item_format(u, f, "n-accepted", "%u", s->n_accepted); if (s->control_pid > 0) - unit_serialize_item_format(u, f, "control-pid", "%u", (unsigned) s->control_pid); + unit_serialize_item_format(u, f, "control-pid", "%lu", (unsigned long) s->control_pid); if (s->control_command_id >= 0) unit_serialize_item(u, f, "control-command", socket_exec_command_to_string(s->control_command_id)); @@ -1110,12 +1110,12 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, else s->n_accepted += k; } else if (streq(key, "control-pid")) { - unsigned pid; + pid_t pid; - if ((r = safe_atou(value, &pid)) < 0 || pid <= 0) + if ((r = parse_pid(value, &pid)) < 0) log_debug("Failed to parse control-pid value %s", value); else - s->control_pid = (pid_t) pid; + s->control_pid = pid; } else if (streq(key, "control-command")) { SocketExecCommand id; |