removed fopencookie for redirecting logs in daemon mode because of (again) muslc incompatibility

This commit is contained in:
Vincent-FK 2021-04-05 17:32:43 +02:00
parent de28915863
commit bdbe6e354a
2 changed files with 7 additions and 1 deletions

5
main.c
View File

@ -213,10 +213,15 @@ int main(int argc, char *argv[])
if (daemon) {
/* Run as a background daemon, redirect all output to syslog */
printf("Func %s, line %d\n", __func__, __LINE__);
openlog("fkgpiod", LOG_PERROR | LOG_PID | LOG_NDELAY, LOG_DAEMON);
printf("Func %s, line %d\n", __func__, __LINE__);
to_log(&stdout);
printf("Func %s, line %d\n", __func__, __LINE__);
to_log(&stderr);
printf("Func %s, line %d\n", __func__, __LINE__);
daemonize("/", PID_FILE);
printf("Func %s, line %d\n", __func__, __LINE__);
}
/* Initialize the uinput device */

View File

@ -81,5 +81,6 @@ static cookie_io_functions_t log_fns = {
/* Redirect given file output descriptor to syslog */
void to_log(FILE **pfp)
{
setvbuf(*pfp = fopencookie(NULL, "w", log_fns), NULL, _IOLBF, 0);
//setvbuf(*pfp = fopencookie(NULL, "w", log_fns), NULL, _IOLBF, 0); //not working with muslc
setvbuf(*pfp, NULL, _IOLBF, 0);
}