linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* close the syslog
@ 2004-10-17  0:49 Kay Sievers
  2004-10-18 17:18 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Kay Sievers @ 2004-10-17  0:49 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 107 bytes --]

Seems that we never closed the opened syslog.
Here is a patch to do this in all our binaries.

Thanks,
Kay

[-- Attachment #2: udev-logging-01.patch --]
[-- Type: text/plain, Size: 3645 bytes --]

===== logging.h 1.12 vs edited =====
--- 1.12/logging.h	2004-03-03 22:04:13 +01:00
+++ edited/logging.h	2004-10-16 22:34:30 +02:00
@@ -27,7 +27,8 @@
 #define info(format, arg...)		do { } while (0)
 #define dbg(format, arg...)		do { } while (0)
 #define dbg_parse(format, arg...)	do { } while (0)
-#define init_logging(foo)		do { } while (0)
+#define logging_init(foo)		do { } while (0)
+#define logging_close(foo)		do { } while (0)
 
 #ifdef LOG
 #include <stdarg.h>
@@ -65,11 +66,17 @@ extern void log_message(int level, const
 /* each program that uses syslog must declare this variable somewhere */
 extern unsigned char logname[LOGNAME_SIZE];
 
-#undef init_logging
-static inline void init_logging(char *program_name)
+#undef logging_init
+static inline void logging_init(char *program_name)
 {
 	snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid());
 	openlog(logname, 0, LOG_DAEMON);
+}
+
+#undef logging_close
+static inline void logging_close(void)
+{
+	closelog();
 }
 
 #endif	/* LOG */
===== udev.c 1.68 vs edited =====
--- 1.68/udev.c	2004-10-14 15:13:55 +02:00
+++ edited/udev.c	2004-10-16 22:34:30 +02:00
@@ -122,7 +122,7 @@ int main(int argc, char *argv[], char *e
 	main_argv = argv;
 	main_envp = envp;
 
-	init_logging("udev");
+	logging_init("udev");
 
 	udev_init_config();
 
@@ -203,5 +203,6 @@ int main(int argc, char *argv[], char *e
 	udevdb_exit();
 
 exit:
+	logging_close();
 	return retval;
 }
===== udevd.c 1.40 vs edited =====
--- 1.40/udevd.c	2004-10-10 00:27:13 +02:00
+++ edited/udevd.c	2004-10-16 22:34:30 +02:00
@@ -150,7 +150,7 @@ static void udev_run(struct hotplug_msg 
 		/* child */
 		execle(udev_bin, "udev", msg->subsystem, NULL, env);
 		dbg("exec of child failed");
-		exit(1);
+		_exit(1);
 		break;
 	case -1:
 		dbg("fork of child failed");
@@ -403,7 +403,7 @@ int main(int argc, char *argv[])
 	struct sigaction act;
 	fd_set readfds;
 
-	init_logging("udevd");
+	logging_init("udevd");
 	dbg("version %s", UDEV_VERSION);
 
 	if (getuid() != 0) {
@@ -549,5 +549,6 @@ int main(int argc, char *argv[])
 	}
 exit:
 	close(ssock);
+	logging_close();
 	exit(1);
 }
===== udevinfo.c 1.23 vs edited =====
--- 1.23/udevinfo.c	2004-03-28 07:20:28 +02:00
+++ edited/udevinfo.c	2004-10-16 22:34:29 +02:00
@@ -447,18 +447,18 @@ help:
 
 int main(int argc, char *argv[], char *envp[])
 {
-	int retval;
+	int rc = 0;
 
 	main_argv = argv;
 	main_argc = argc;
 
-	init_logging("udevinfo");
+	logging_init("udevinfo");
 
 	/* initialize our configuration */
 	udev_init_config();
 
-	retval = process_options();
-	if (retval != 0)
-		exit(1);
-	exit(0);
+	rc = process_options();
+
+	logging_close();
+	exit(rc);
 }
===== udevsend.c 1.32 vs edited =====
--- 1.32/udevsend.c	2004-09-20 16:01:58 +02:00
+++ edited/udevsend.c	2004-10-16 22:34:31 +02:00
@@ -123,7 +123,7 @@ int main(int argc, char* argv[])
 	socklen_t addrlen;
 	int started_daemon = 0;
 
-	init_logging("udevsend");
+	logging_init("udevsend");
 	dbg("version %s", UDEV_VERSION);
 
 	subsystem = get_subsystem(argv[1]);
@@ -214,6 +214,8 @@ fallback:
 exit:
 	if (sock != -1)
 		close(sock);
+
+	logging_close();
 
 	return retval;
 }
===== wait_for_sysfs.c 1.21 vs edited =====
--- 1.21/wait_for_sysfs.c	2004-10-16 22:33:26 +02:00
+++ edited/wait_for_sysfs.c	2004-10-16 22:37:00 +02:00
@@ -392,7 +392,7 @@ int main(int argc, char *argv[], char *e
 	int rc = 0;
 	const char *error = NULL;
 
-	init_logging("wait_for_sysfs");
+	logging_init("wait_for_sysfs");
 
 	if (argc != 2) {
 		dbg("error: subsystem");
@@ -475,5 +475,6 @@ exit:
 		dbg("result: waiting for sysfs successful '%s'", devpath);
 	}
 
+	logging_close();
 	exit(rc);
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: close the syslog
  2004-10-17  0:49 close the syslog Kay Sievers
@ 2004-10-18 17:18 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-10-18 17:18 UTC (permalink / raw)
  To: linux-hotplug

On Sun, Oct 17, 2004 at 02:49:07AM +0200, Kay Sievers wrote:
> Seems that we never closed the opened syslog.
> Here is a patch to do this in all our binaries.

Applied, thanks.

greg k-h


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-18 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-17  0:49 close the syslog Kay Sievers
2004-10-18 17:18 ` Greg KH

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).