close socket command

We don't close the command socket after the transaction, that leads
to a fd leak.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Daniel Lezcano 2010-05-19 22:15:28 +02:00 committed by Daniel Lezcano
parent da2aef7f9a
commit 1362f2eba1

View File

@ -93,22 +93,18 @@ extern int lxc_command(const char *name, struct lxc_command *command,
sizeof(command->request)); sizeof(command->request));
if (ret < 0) { if (ret < 0) {
SYSERROR("failed to send request to '@%s'", offset); SYSERROR("failed to send request to '@%s'", offset);
goto out_close; goto out;
} }
if (ret != sizeof(command->request)) { if (ret != sizeof(command->request)) {
SYSERROR("message partially sent to '@%s'", offset); SYSERROR("message partially sent to '@%s'", offset);
goto out_close; goto out;
} }
ret = receive_answer(sock, &command->answer); ret = receive_answer(sock, &command->answer);
if (ret < 0)
goto out_close;
out: out:
return ret;
out_close:
close(sock); close(sock);
goto out; return ret;
} }
pid_t get_init_pid(const char *name) pid_t get_init_pid(const char *name)