Просмотр исходного кода

changed the seteuid(0) errors to warning, and only print if debugging is enabled

Bryan Heden 8 лет назад
Родитель
Сommit
005e20ffec
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      src/nrpe.c

+ 4 - 4
src/nrpe.c

@@ -2221,8 +2221,8 @@ int my_system(char *command, int timeout, int *early_timeout, char **output)
 	if (pid == 0) {
 
 		/* get root back so the next call works correctly */
-		if (SETEUID(0) == -1)
-			logit(LOG_ERR, "ERROR: my_system() seteuid(0): %s", strerror(errno));
+		if (SETEUID(0) == -1 && debug)
+			logit(LOG_WARNING, "WARNING: my_system() seteuid(0): %s", strerror(errno));
 
 		drop_privileges(nrpe_user, nrpe_group, 1);	/* drop privileges */
 		close(fd[0]);			/* close pipe for reading */
@@ -2493,8 +2493,8 @@ int remove_pid_file(void)
 		return OK;				/* pid file was not written */
 
 	/* get root back so we can delete the pid file */
-	if (SETEUID(0) == -1)
-		logit(LOG_ERR, "ERROR: remove_pid_file() seteuid(0): %s", strerror(errno));
+	if (SETEUID(0) == -1 && debug)
+		logit(LOG_WARNING, "WARNING: remove_pid_file() seteuid(0): %s", strerror(errno));
 
 	if (unlink(pid_file) == -1) {
 		logit(LOG_ERR, "Cannot remove pidfile '%s' - check your privileges.", pid_file);