diff --git a/src/utils.c b/src/utils.c index fd277d2c..3779265a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -102,7 +102,11 @@ int run_as(const char *user) /* Note that we use getpwnam_r() instead of getpwnam(), which returns its result in a statically allocated buffer and cannot be considered thread safe. */ +#ifndef __sun err = getpwnam_r(user, &pwdbuf, buf, buflen, &pwd); +#else + pwd = getpwnam_r(user, &pwdbuf, buf, buflen); +#endif if (err == 0 && pwd) { /* setgid first, because we may not be allowed to do it anymore after setuid */ if (setgid(pwd->pw_gid) != 0) { @@ -309,7 +313,7 @@ void daemonize(const char * path) FATAL("Invalid pid file\n"); } - fprintf(file, "%d", pid); + fprintf(file, "%d", (int)pid); fclose(file); exit(EXIT_SUCCESS); }