From 94c7c613f4c66a36c81edae74a42024015122c16 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 12 Jan 2009 15:52:14 +0100 Subject: [PATCH] Cosmetics: Rename some functions. Add "_or_die" suffix to functions that exit on errors. --- audiod.c | 2 +- daemon.c | 2 +- daemon.h | 2 +- server.c | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/audiod.c b/audiod.c index 56661b80..fc4ac6f5 100644 --- a/audiod.c +++ b/audiod.c @@ -1136,7 +1136,7 @@ int main(int argc, char *argv[]) valid_fd_012(); audiod_cmdline_parser_ext(argc, argv, &conf, ¶ms); HANDLE_VERSION_FLAG("audiod", conf); - para_drop_privileges(conf.user_arg, conf.group_arg); + drop_privileges_or_die(conf.user_arg, conf.group_arg); parse_config_or_die(); if (conf.logfile_given) logfile = open_log(conf.logfile_arg); diff --git a/daemon.c b/daemon.c index f7a19221..6c1321b2 100644 --- a/daemon.c +++ b/daemon.c @@ -116,7 +116,7 @@ void log_welcome(const char *whoami, int loglevel) * * \sa getpwnam(3), getuid(2), setuid(2), getgrnam(2), setgid(2) */ -void para_drop_privileges(const char *username, const char *groupname) +void drop_privileges_or_die(const char *username, const char *groupname) { struct passwd *p; char *tmp; diff --git a/daemon.h b/daemon.h index e1b8149a..4f071361 100644 --- a/daemon.h +++ b/daemon.h @@ -5,7 +5,7 @@ void daemon_init(void); FILE *open_log(const char *logfile_name); void close_log(FILE* logfile); void log_welcome(const char *whoami, int loglevel); -void para_drop_privileges(const char *username, const char *groupname); +void drop_privileges_or_die(const char *username, const char *groupname); /** used for server_uptime() */ enum uptime {UPTIME_SET, UPTIME_GET}; time_t server_uptime(enum uptime set_or_get); diff --git a/server.c b/server.c index 287b628b..a1180673 100644 --- a/server.c +++ b/server.c @@ -166,7 +166,7 @@ __printf_2_3 void para_log(int ll, const char* fmt,...) /* * setup shared memory area and get mutex for locking */ -static void shm_init(void) +static void init_ipc_or_die(void) { void *shm; int ret = shm_new(sizeof(struct misc_meta_data)); @@ -198,7 +198,7 @@ err_out: exit(EXIT_FAILURE); } -static void parse_config(int override) +static void parse_config_or_die(int override) { char *home = para_homedir(); struct stat statbuf; @@ -259,7 +259,7 @@ static void handle_sighup(void) PARA_NOTICE_LOG("SIGHUP\n"); close_log(logfile); /* gets reopened if necessary by parse_config */ logfile = NULL; - parse_config(1); /* reopens log */ + parse_config_or_die(1); /* reopens log */ init_user_list(user_list_file); /* reload user list */ if (mmd->afs_pid) kill(mmd->afs_pid, SIGHUP); @@ -482,11 +482,11 @@ static void server_init(int argc, char **argv) /* parse command line options */ server_cmdline_parser_ext(argc, argv, &conf, ¶ms); HANDLE_VERSION_FLAG("server", conf); - para_drop_privileges(conf.user_arg, conf.group_arg); + drop_privileges_or_die(conf.user_arg, conf.group_arg); /* parse config file, open log and set defaults */ - parse_config(0); + parse_config_or_die(0); log_welcome("para_server", conf.loglevel_arg); - shm_init(); /* init mmd struct */ + init_ipc_or_die(); /* init mmd struct and mmd->lock */ /* make sure, the global now pointer is uptodate */ gettimeofday(now, NULL); server_uptime(UPTIME_SET); /* reset server uptime */ -- 2.39.5