Re: [master] Introduces rsylogd to anaconda (part of #524980)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This piece of code deserves better comments explaining all the "magic" happening to stderr and what the first call to rsyslog exactly does.

> +    /* Check that the final config file is sane. Disable stderr
> temporarily */
> +    int stderr_dup;
> +    int status;
> +    stderr_dup = dup(2);
>      close(2);
> -
> -    dup2(1, log);
> -
> -#if defined(USE_LOGDEV)
> -    /* now open the syslog socket */
> -    sockaddr.sun_family = AF_UNIX;
> -    strcpy(sockaddr.sun_path, "/dev/log");
> -    sock = socket(AF_UNIX, SOCK_STREAM, 0);
> -    if (sock < 0) {
> -        printf("error creating socket: %d\n", errno);
> -        sleep(5);
> -    }
> -    printstr("got socket\n");
> -    if (bind(sock, (struct sockaddr *) &sockaddr,
> sizeof(sockaddr.sun_family) + 
> -			strlen(sockaddr.sun_path))) {
> -        printf("bind error: %d\n", errno);
> -        sleep(5);
> -    }
> -    printstr("bound socket\n");
> -    chmod("/dev/log", 0666);
> -    if (listen(sock, 5)) {
> -        printf("listen error: %d\n", errno);
> -        sleep(5);
> +    status = system("/sbin/rsyslogd -c 4n -N1");
> +    dup2(stderr_dup, 2); /* restore stderr */
> +    if (status < 0 || 
> +        !WIFEXITED(status) || 
> +        WEXITSTATUS(status)  != 0) {
> +        printf("Unable to start syslog daemon due to its
> configuration file "
> +               "being corrupted. Did you pass in a wrong
> \"syslog=\"?\n");
> +        fatal_error(1);
>      }


Martin

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux