X-Git-Url: https://unix4lyfe.org/gitweb/darkstat-debian/blobdiff_plain/a1e8056c92203d02860d719abb1d562453896da8..3c6b3682c70be84db86e70c191016913a9836c31:/conv.c?ds=sidebyside diff --git a/conv.c b/conv.c index 4ff95ae..265f864 100644 --- a/conv.c +++ b/conv.c @@ -1,5 +1,5 @@ /* darkstat 3 - * copyright (c) 2001-2011 Emil Mikulic. + * copyright (c) 2001-2014 Emil Mikulic. * * conv.c: convenience functions. * @@ -288,9 +288,7 @@ daemonize_finish(void) * For security, chroot (optionally) and drop privileges. * Pass a NULL chroot_dir to disable chroot() behaviour. */ -void -privdrop(const char *chroot_dir, const char *privdrop_user) -{ +void privdrop(const char *chroot_dir, const char *privdrop_user) { struct passwd *pw; errno = 0; @@ -302,7 +300,9 @@ privdrop(const char *chroot_dir, const char *privdrop_user) else err(1, "getpwnam(\"%s\") failed", privdrop_user); } - if (chroot_dir != NULL) { + if (chroot_dir == NULL) { + verbosef("no --chroot dir specified, darkstat will not chroot()"); + } else { tzset(); /* read /etc/localtime before we chroot */ if (chdir(chroot_dir) == -1) err(1, "chdir(\"%s\") failed", chroot_dir); @@ -344,3 +344,5 @@ fd_set_block(const int fd) err(1, "fcntl(fd %d) to unset O_NONBLOCK", fd); assert( (fcntl(fd, F_GETFL, 0) & O_NONBLOCK ) == 0 ); } + +/* vim:set ts=3 sw=3 tw=78 expandtab: */