> +#ifndef HAVE_DAEMON
> +static int
> +daemon(int nochdir, int noclose) {
Seeing duplicate definitions of daemon() in my build. No -DHAVE_DAEMON
in the gcc line apparently.
Missing configure.in check?
> + int rv, fd;
> +
> + switch (fork()) {
> + case -1:
> + return (-1);
> + case 0:
> + break;
> + default:
> + exit (0);
> + }
> +
> + if (setsid() == -1)
> + return (-1);
> + if (!nochdir)
> + (void) chdir("/");
> + if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
This is probably because of the HAVE_DAEMON, but because you've only
included fcntl.h for the SOLARIS case, Linux is complaining about
undeclared open() and O_RDWR.
So maybe replace #ifdef SOLARIS by #ifndef HAVE_DAEMON up above?
> + (void) dup2(fd, STDIN_FILENO);
> + (void) dup2(fd, STDOUT_FILENO);
> + (void) dup2(fd, STDERR_FILENO);
> + if (fd > 2)
> + (void)close (fd);
> + }
> + return (0);
> +}
> +#endif /* !HAVE_DAEMON */
> +
> int
> main(int argc, char **argv)
> {
> struct sockaddr_in serv_addr, client_addr;
> TSS_RESULT result;
> - int sd, newsd, c, option_index = 0;
> + int sd, newsd, c, rv, option_index = 0;
rv won't be used #ifndef SOLARIS
> unsigned client_len;
> char *hostname = NULL;
> struct passwd *pwd;
> @@ -245,6 +323,12 @@
> LogError("Failed socket: %s", strerror(errno));
> return -1;
> }
> +#ifdef SOLARIS
> + /* For Solaris, drop privileges for security. */
> + rv = drop_privs();
> + if (rv)
> + return (rv);
> +#endif /* SOLARIS */
>
> memset(&serv_addr, 0, sizeof (serv_addr));
> serv_addr.sin_family = AF_INET;
>
Thanks,
-Klaus
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech