- char *name;
- int retval = 0;
-
- if(sock_path) {
- asprintf(&name, "%s", sock_path);
- }
- else {
- int result;
-
- /* Only check if socket dir exists if we are using the default directory */
- result = ensure_dir_exists(SOCK_DIR);
- if(result == -1) {
- ERR("Unable to create socket directory %s", SOCK_DIR);
- return -1;
- }
-
- asprintf(&name, "%s/%s", SOCK_DIR, "ustd");
- }
-
- handle->server.listen_fd = init_named_socket(name, &handle->server.socketpath);
- if(handle->server.listen_fd < 0) {
- ERR("error initializing named socket at %s", name);
- retval = -1;
- goto free_name;