Remove duplicate code in ctl_bind()

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-06-24 12:22:54 +00:00
parent 968cafe21b
commit 7e95f7a8ae

View File

@@ -69,20 +69,14 @@ ctl_bind(int fd, const char *dir, const char *file)
if (ctl_setsun(&sun, dir, name))
return -1;
if (!bind(fd, (struct sockaddr *)&sun, sizeof(sun)))
return 0;
} else {
if (ctl_setsun(&sun, dir, file))
return -1;
unlink(sun.sun_path);
if (!bind(fd, (struct sockaddr *)&sun, sizeof(sun)))
return 0;
}
return -1;
return bind(fd, (struct sockaddr *)&sun, sizeof(sun));
}
void