* lock file. But this is enough to detect a simple mistake that
* at least one person has actually made.
*/
- if (service->directory != NULL) {
+ if (!rend_service_is_ephemeral(service)) {
/* Skip dupe for ephemeral services. */
- SMARTLIST_FOREACH(rend_service_list, rend_service_t*, ptr,
+ SMARTLIST_FOREACH(s_list, rend_service_t*, ptr,
dupe = dupe ||
!strcmp(ptr->directory, service->directory));
if (dupe) {
return -1;
}
}
- smartlist_add(rend_service_list, service);
+ smartlist_add(s_list, service);
- log_debug(LD_REND,"Configuring service with directory \"%s\"",
- service->directory);
+ log_debug(LD_REND,"Configuring service with directory %s",
+ rend_service_escaped_dir(service));
for (i = 0; i < smartlist_len(service->ports); ++i) {
p = smartlist_get(service->ports, i);
if (!(p->is_unix_addr)) {
char *poison_fname = NULL;
file_status_t fstatus;
- if (!service->directory) {
+ /* Passing a NULL service is a bug */
+ if (BUG(!service)) {
+ return 0;
+ }
+
+ if (rend_service_is_ephemeral(service)) {
return 0;
}