@@ -1165,14 +1165,12 @@ static int server_fd = -1;
void control_server(const char *path)
{
struct sockaddr_un addr;
- size_t len;
int fd;
if (server_fd >= 0)
return;
- len = strlen(path);
- if (len > sizeof(addr.sun_path) - 1) {
+ if (strlen(path) > sizeof(addr.sun_path) - 1) {
fprintf(stderr, "Socket name too long\n");
return;
}
@@ -1187,7 +1185,7 @@ void control_server(const char *path)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, path, len - 1);
+ strcpy(addr.sun_path, path);
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("Failed to bind server socket");