if (lxc_monitor_sock_name(lxcpath, &addr) < 0)
return -1;
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
- ERROR("Failed to create socket: %s.", strerror(errno));
- return -1;
- }
-
len = strlen(&addr.sun_path[1]);
DEBUG("opening monitor socket %s with len %zu", &addr.sun_path[1], len);
if (len >= sizeof(addr.sun_path) - 1) {
errno = ENAMETOOLONG;
ERROR("name of monitor socket too long (%zu bytes): %s", len, strerror(errno));
- close(fd);
return -1;
}
if (lxc_monitor_sock_name(lxcpath, &addr) < 0)
return -1;
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
- fprintf(stderr, "Failed to create socket: %s\n", strerror(errno));
- return -errno;
- }
-
len = strlen(&addr.sun_path[1]);
if (len >= sizeof(addr.sun_path) - 1) {
errno = ENAMETOOLONG;
- close(fd);
fprintf(stderr, "name of monitor socket too long (%zu bytes): %s\n", len, strerror(errno));
return -errno;
}