summaryrefslogtreecommitdiff
path: root/src/daemon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon.h')
-rw-r--r--src/daemon.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/daemon.h b/src/daemon.h
index 071765e..4cc10e8 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -59,7 +59,7 @@ int priv_init(priv_info_t* priv, const char* username, const char* groupname)
priv->pw_ = getpwnam(username);
if(!priv->pw_) {
- log_printf(ERR, "unkown user %s", username);
+ log_printf(ERROR, "unkown user %s", username);
return -1;
}
@@ -69,7 +69,7 @@ int priv_init(priv_info_t* priv, const char* username, const char* groupname)
priv->gr_ = getgrgid(priv->pw_->pw_gid);
if(!priv->gr_) {
- log_printf(ERR, "unkown group %s", groupname);
+ log_printf(ERROR, "unkown group %s", groupname);
return -1;
}
@@ -79,24 +79,24 @@ int priv_init(priv_info_t* priv, const char* username, const char* groupname)
int priv_drop(priv_info_t* priv)
{
if(!priv || !priv->pw_ || !priv->gr_) {
- log_printf(ERR, "privileges not initialized properly");
+ log_printf(ERROR, "privileges not initialized properly");
return -1;
}
if(setgid(priv->gr_->gr_gid)) {
- log_printf(ERR, "setgid('%s') failed: %m", priv->gr_->gr_name);
+ log_printf(ERROR, "setgid('%s') failed: %m", priv->gr_->gr_name);
return -1;
}
gid_t gr_list[1];
gr_list[0] = priv->gr_->gr_gid;
if(setgroups (1, gr_list)) {
- log_printf(ERR, "setgroups(['%s']) failed: %m", priv->gr_->gr_name);
+ log_printf(ERROR, "setgroups(['%s']) failed: %m", priv->gr_->gr_name);
return -1;
}
if(setuid(priv->pw_->pw_uid)) {
- log_printf(ERR, "setuid('%s') failed: %m", priv->pw_->pw_name);
+ log_printf(ERROR, "setuid('%s') failed: %m", priv->pw_->pw_name);
return -1;
}
@@ -108,17 +108,17 @@ int priv_drop(priv_info_t* priv)
int do_chroot(const char* chrootdir)
{
if(getuid() != 0) {
- log_printf(ERR, "this programm has to be run as root in order to run in a chroot");
+ log_printf(ERROR, "this programm has to be run as root in order to run in a chroot");
return -1;
}
if(chroot(chrootdir)) {
- log_printf(ERR, "can't chroot to %s: %m", chrootdir);
+ log_printf(ERROR, "can't chroot to %s: %m", chrootdir);
return -1;
}
log_printf(NOTICE, "we are in chroot jail (%s) now", chrootdir);
if(chdir("/")) {
- log_printf(ERR, "can't change to /: %m");
+ log_printf(ERROR, "can't change to /: %m");
return -1;
}
}
@@ -129,7 +129,7 @@ void daemonize()
pid = fork();
if(pid < 0) {
- log_printf(ERR, "daemonizing failed at fork(): %m, exitting");
+ log_printf(ERROR, "daemonizing failed at fork(): %m, exitting");
exit(-1);
}
if(pid) exit(0);
@@ -137,19 +137,19 @@ void daemonize()
umask(0);
if(setsid() < 0) {
- log_printf(ERR, "daemonizing failed at setsid(): %m, exitting");
+ log_printf(ERROR, "daemonizing failed at setsid(): %m, exitting");
exit(-1);
}
pid = fork();
if(pid < 0) {
- log_printf(ERR, "daemonizing failed at fork(): %m, exitting");
+ log_printf(ERROR, "daemonizing failed at fork(): %m, exitting");
exit(-1);
}
if(pid) exit(0);
if ((chdir("/")) < 0) {
- log_printf(ERR, "daemonizing failed at chdir(): %m, exitting");
+ log_printf(ERROR, "daemonizing failed at chdir(): %m, exitting");
exit(-1);
}