+ pid_fd = open_pidfile("create", O_CREAT|O_EXCL|O_WRONLY);
+ if (pid_fd < 0)
+ pid_fd = check_pidfile();
+ if (pid_fd < 0)
+ return pid_fd;
+
+ /* open all the listen sockets */
+ if (config_listen_address_list_len > 0)
+ {
+ for (int i = 0; i < config_listen_address_list_len; i++)
+ {
+ open_listen_socket (config_listen_address_list[i]);
+ free_listen_socket (config_listen_address_list[i]);
+ }
+
+ free(config_listen_address_list);
+ }
+ else
+ {
+ listen_socket_t sock;
+ memset(&sock, 0, sizeof(sock));
+ strncpy(sock.addr, RRDCACHED_DEFAULT_ADDRESS, sizeof(sock.addr));
+ open_listen_socket (&sock);
+ }
+
+ if (listen_fds_num < 1)
+ {
+ fprintf (stderr, "rrdcached: FATAL: cannot open any listen sockets\n");
+ goto error;
+ }