mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
config: reset conf file descriptor after closing file stream
conf file descriptor is closed once again during cleanup at the end of config_load() if descriptor >= 0. avoid double closing by assigning negative value to fd after first close. by the time second close happens some other descriptor might be opened reusing previous number ie it might happen during foot server startup when syslog message is logged between one close and the other. in this particular situation, as of this writing, it considers fd=3 for which following events apply: 1. conf file is opened and fclosed() 2. warning is logged with syslog which leads to opening socket to /dev/log which is kept open by glibc (gets fd=3) 3. second close during config_load() closes /dev/log socket descriptor 4. epoll_create() in fdm.c reuses fd=3 again 5. another message is being logged with syslog. glibc notices sendto() failure on saved /dev/log descriptor hence it closes it and opens new one Due to epoll descriptor closure foot starts a chain of errors that lead to startup failure. Fixes #1531
This commit is contained in:
parent
ee02e7b07d
commit
8e1b51be10
1 changed files with 1 additions and 0 deletions
1
config.c
1
config.c
|
|
@ -3195,6 +3195,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
ret = !errors_are_fatal;
|
||||
|
||||
fclose(f);
|
||||
conf_file.fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue