Fix a wrong open() if no motd is specified.
This commit is contained in:
parent
00995a1946
commit
828c19cfc6
@ -654,7 +654,7 @@ void hub_set_variables(struct hub_info* hub, struct acl_handle* acl)
|
|||||||
|
|
||||||
/* (Re-)read the message of the day */
|
/* (Re-)read the message of the day */
|
||||||
hub->command_motd = 0;
|
hub->command_motd = 0;
|
||||||
fd = open(hub->config->file_motd, 0);
|
fd = (hub->config->file_motd && *hub->config->file_motd) ? open(hub->config->file_motd, 0) : -1;
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
ret = read(fd, buf, MAX_RECV_BUF);
|
ret = read(fd, buf, MAX_RECV_BUF);
|
||||||
@ -665,10 +665,6 @@ void hub_set_variables(struct hub_info* hub, struct acl_handle* acl)
|
|||||||
hub->command_motd = adc_msg_construct(ADC_CMD_IMSG, 6 + strlen(tmp));
|
hub->command_motd = adc_msg_construct(ADC_CMD_IMSG, 6 + strlen(tmp));
|
||||||
adc_msg_add_argument(hub->command_motd, tmp);
|
adc_msg_add_argument(hub->command_motd, tmp);
|
||||||
hub_free(tmp);
|
hub_free(tmp);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user