X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=daemon.c;h=5d4cf6995f7645ef6bc4bb846dc3b1c7284fd4fd;hp=46eb8f19196acfe37f280eb6650223437acdbf1b;hb=9f021e58c181e2cd2e1e245fcd7b84f33ad50f9d;hpb=67cccf4883d30aded54d5d6d748479d800bad3ef diff --git a/daemon.c b/daemon.c index 46eb8f19..5d4cf699 100644 --- a/daemon.c +++ b/daemon.c @@ -1,19 +1,7 @@ /* * Copyright (C) 1997-2006 Andre Noll * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file daemon.c some helpers for programs that detach from the console */ @@ -74,7 +62,7 @@ FILE *open_log(const char *logfile_name) return NULL; if (!(logfile = fopen(logfile_name, "a"))) { PARA_EMERG_LOG("can not open %s, uid: %d\n", logfile_name, - getuid()); + (int)getuid()); exit(EXIT_FAILURE); } setlinebuf(logfile); @@ -135,7 +123,7 @@ void para_drop_privileges(const char *username, const char *groupname) } if (setgid(g->gr_gid) < 0) { PARA_EMERG_LOG("failed to set group id %d (%s)\n", - g->gr_gid, strerror(errno)); + (int)g->gr_gid, strerror(errno)); exit(EXIT_FAILURE); } } @@ -152,7 +140,7 @@ void para_drop_privileges(const char *username, const char *groupname) } PARA_INFO_LOG("%s", "dropping root privileges\n"); setuid(p->pw_uid); - PARA_DEBUG_LOG("uid: %d, euid: %d\n", getuid(), geteuid()); + PARA_DEBUG_LOG("uid: %d, euid: %d\n", (int)getuid(), (int)geteuid()); } /** @@ -171,13 +159,15 @@ time_t server_uptime(enum uptime set_or_get) { static time_t startuptime; time_t now; + double diff; if (set_or_get == UPTIME_SET) { time(&startuptime); return 0; } time(&now); - return (time_t) difftime(now, startuptime); + diff = difftime(now, startuptime); + return (time_t) diff; } /** @@ -189,7 +179,7 @@ time_t server_uptime(enum uptime set_or_get) */ __malloc char *uptime_str(void) { - time_t t = server_uptime(UPTIME_GET); + long t = server_uptime(UPTIME_GET); return make_message("%li:%02li:%02li", t / 86400, (t / 3600) % 24, (t / 60) % 60); }