mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 04:09:46 +00:00
fix the abstract unix socket name
Let's use a more sexy name Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
e98fe68b38
commit
46968ea3cc
@ -54,14 +54,13 @@ static int receive_answer(int sock, struct lxc_answer *answer)
|
|||||||
|
|
||||||
extern int lxc_command(const char *name, struct lxc_command *command)
|
extern int lxc_command(const char *name, struct lxc_command *command)
|
||||||
{
|
{
|
||||||
struct sockaddr_un addr = { 0 };
|
|
||||||
int sock, ret = -1;
|
int sock, ret = -1;
|
||||||
char *offset = &addr.sun_path[1];
|
char path[sizeof(((struct sockaddr_un *)0)->sun_path)] = { 0 };
|
||||||
|
char *offset = &path[1];
|
||||||
|
|
||||||
snprintf(addr.sun_path, sizeof(addr.sun_path), "@%s", name);
|
sprintf(offset, "/var/run/lxc/%s/command", name);
|
||||||
addr.sun_path[0] = '\0';
|
|
||||||
|
|
||||||
sock = lxc_af_unix_connect(addr.sun_path);
|
sock = lxc_af_unix_connect(path);
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
WARN("failed to connect to '@%s': %s", offset, strerror(errno));
|
WARN("failed to connect to '@%s': %s", offset, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
@ -202,13 +201,12 @@ extern int lxc_command_mainloop_add(const char *name, struct lxc_epoll_descr *de
|
|||||||
struct lxc_handler *handler)
|
struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
int ret, fd;
|
int ret, fd;
|
||||||
struct sockaddr_un addr = { 0 };
|
char path[sizeof(((struct sockaddr_un *)0)->sun_path)] = { 0 };
|
||||||
char *offset = &addr.sun_path[1];
|
char *offset = &path[1];
|
||||||
|
|
||||||
strcpy(offset, name);
|
sprintf(offset, "/var/run/lxc/%s/command", name);
|
||||||
addr.sun_path[0] = '\0';
|
|
||||||
|
|
||||||
fd = lxc_af_unix_open(addr.sun_path, SOCK_STREAM, 0);
|
fd = lxc_af_unix_open(path, SOCK_STREAM, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
ERROR("failed to create the command service point");
|
ERROR("failed to create the command service point");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user