netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Leblond <eric@inl.fr>
To: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Ulogd2: ulogd2 warn when exiting on error
Date: Thu, 03 Jan 2008 14:25:29 +0100	[thread overview]
Message-ID: <1199366729.11916.6.camel@khasse.inl.fr> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 247 bytes --]

Hi,

This patch adds a warning message to ulogd2 when it exits on error. It
simply tell to look at the configuration file.

BR,
-- 
Éric Leblond, eleblond@inl.fr
Téléphone : 01 44 89 46 40, Fax : 01 44 89 45 01
INL, http://www.inl.fr

[-- Attachment #1.2: ulogd2-warn-when-exit.diff --]
[-- Type: text/x-patch, Size: 1805 bytes --]

=== src/ulogd.c
==================================================================
--- src/ulogd.c	(revision 4880)
+++ src/ulogd.c	(revision 4881)
@@ -315,6 +315,13 @@
 	}
 }
 
+static void warn_and_exit(int daemonize)
+{
+	if (!daemonize)
+		fprintf(stderr, "Fatal error, check logfile.\n");
+	exit(1);
+}
+
 /* clean results (set all values to 0 and free pointers) */
 static void ulogd_clean_results(struct ulogd_pluginstance *pi)
 {
@@ -914,44 +921,44 @@
 	if (config_register_file(ulogd_configfile)) {
 		ulogd_log(ULOGD_FATAL, "error registering configfile \"%s\"\n",
 			  ulogd_configfile);
-		exit(1);
+		warn_and_exit(daemonize);
 	}
 	
 	/* parse config file */
 	if (parse_conffile("global", &ulogd_kset)) {
 		ulogd_log(ULOGD_FATAL, "parse_conffile\n");
-		exit(1);
+		warn_and_exit(daemonize);
 	}
 
 	if (llist_empty(&ulogd_pi_stacks)) {
 		ulogd_log(ULOGD_FATAL, 
 			  "not even a single working plugin stack\n");
-		exit(1);
+		warn_and_exit(daemonize);
 	}
 
 	if (change_uid) {
 		ulogd_log(ULOGD_NOTICE, "Changing UID / GID\n");
 		if (setgid(gid)) {
 			ulogd_log(ULOGD_FATAL, "can't set GID %u\n", gid);
-			exit(1);
+			warn_and_exit(daemonize);
 		}
 		if (setegid(gid)) {
 			ulogd_log(ULOGD_FATAL, "can't set effective GID %u\n",
 				  gid);
-			exit(1);
+			warn_and_exit(daemonize);
 		}
 		if (initgroups(user, gid)) {
 			ulogd_log(ULOGD_FATAL, "can't set user secondary GID\n");
-			exit(1);
+			warn_and_exit(daemonize);
 		}
 		if (setuid(uid)) {
 			ulogd_log(ULOGD_FATAL, "can't set UID %u\n", uid);
-			exit(1);
+			warn_and_exit(daemonize);
 		}
 		if (seteuid(uid)) {
 			ulogd_log(ULOGD_FATAL, "can't set effective UID %u\n",
 				  uid);
-			exit(1);
+			warn_and_exit(daemonize);
 		}
 	}
 

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2008-01-03 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 13:25 Eric Leblond [this message]
2008-01-03 17:41 ` Ulogd2: ulogd2 warn when exiting on error Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1199366729.11916.6.camel@khasse.inl.fr \
    --to=eric@inl.fr \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).