stop spamming syslog

epel9
Matthias Clasen 17 years ago
parent 93faf2d7f4
commit 751fa16235

@ -5,7 +5,7 @@
Summary: A process-transparent configuration system Summary: A process-transparent configuration system
Name: GConf2 Name: GConf2
Version: 2.22.0 Version: 2.22.0
Release: 3%{?dist} Release: 4%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Base Group: System Environment/Base
Source: http://download.gnome.org/sources/GConf/2.22/GConf-%{version}.tar.bz2 Source: http://download.gnome.org/sources/GConf/2.22/GConf-%{version}.tar.bz2
@ -36,6 +36,8 @@ Patch1: GConf2-2.14.0-timeout.patch
Patch2: gconf-timeouts.patch Patch2: gconf-timeouts.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=531169 # http://bugzilla.gnome.org/show_bug.cgi?id=531169
Patch3: gconf-defaults.patch Patch3: gconf-defaults.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=126468
Patch4: gconf-no-syslog.patch
%description %description
GConf is a process-transparent configuration database API used to GConf is a process-transparent configuration database API used to
@ -74,6 +76,7 @@ which require GTK+.
%patch1 -p1 -b .timers %patch1 -p1 -b .timers
%patch2 -p1 -b .timeouts %patch2 -p1 -b .timeouts
%patch3 -p1 -b .defaults %patch3 -p1 -b .defaults
%patch4 -p1 -b .no-syslog
%build %build
rm -f libtool rm -f libtool

@ -0,0 +1,274 @@
diff -Nur -x '*.orig' -x '*~' gconf-2.21.1/gconf/gconfd.c gconf-2.21.1.new/gconf/gconfd.c
--- gconf-2.21.1/gconf/gconfd.c 2008-01-08 15:27:41.000000000 +0100
+++ gconf-2.21.1.new/gconf/gconfd.c 2008-01-14 12:06:23.000000000 +0100
@@ -49,9 +49,6 @@
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
#include <time.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@@ -500,41 +497,6 @@
return the_poa;
}
-static void
-log_handler (const gchar *log_domain,
- GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
-{
- GConfLogPriority pri = GCL_WARNING;
-
- switch (log_level & G_LOG_LEVEL_MASK)
- {
- case G_LOG_LEVEL_ERROR:
- case G_LOG_LEVEL_CRITICAL:
- pri = GCL_ERR;
- break;
-
- case G_LOG_LEVEL_WARNING:
- pri = GCL_WARNING;
- break;
-
- case G_LOG_LEVEL_MESSAGE:
- case G_LOG_LEVEL_INFO:
- pri = GCL_INFO;
- break;
-
- case G_LOG_LEVEL_DEBUG:
- pri = GCL_DEBUG;
- break;
-
- default:
- break;
- }
-
- gconf_log (pri, "%s", message);
-}
-
/* From ORBit2 */
/* There is a DOS attack if another user creates
* the given directory and keeps us from creating
@@ -597,8 +559,6 @@
#endif
CORBA_Environment ev;
CORBA_ORB orb;
- gchar* logname;
- const gchar* username;
gchar* ior;
int exit_code = 0;
GError *err;
@@ -646,27 +606,7 @@
gconf_set_daemon_mode(TRUE);
- /* Logs */
- username = g_get_user_name();
- logname = g_strdup_printf("gconfd (%s-%u)", username, (guint)getpid());
-
-#ifdef HAVE_SYSLOG_H
- openlog (logname, LOG_NDELAY, LOG_USER);
-#endif
-
- g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
- log_handler, NULL);
-
- /* openlog() does not copy logname - what total brokenness.
- So we free it at the end of main() */
-
- gconf_log (GCL_INFO, _("starting (version %s), pid %u user '%s'"),
+ gconf_log (GCL_DEBUG, _("starting (version %s), pid %u user '%s'"),
VERSION, (guint)getpid(), g_get_user_name());
#ifdef GCONF_ENABLE_DEBUG
@@ -831,14 +771,7 @@
daemon_lock = NULL;
- gconf_log (GCL_INFO, _("Exiting"));
-
-#ifdef HAVE_SYSLOG_H
- closelog ();
-#endif
-
- /* Can't do this due to stupid atexit() handler that calls g_log stuff */
- /* g_free (logname); */
+ gconf_log (GCL_DEBUG, _("Exiting"));
return exit_code;
}
diff -Nur -x '*.orig' -x '*~' gconf-2.21.1/gconf/gconf-internals.c gconf-2.21.1.new/gconf/gconf-internals.c
--- gconf-2.21.1/gconf/gconf-internals.c 2008-01-08 15:28:59.000000000 +0100
+++ gconf-2.21.1.new/gconf/gconf-internals.c 2008-01-14 12:06:23.000000000 +0100
@@ -1096,105 +1096,46 @@
* Log
*/
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-
void
gconf_log(GConfLogPriority pri, const gchar* fmt, ...)
{
- gchar* msg;
va_list args;
-#ifdef HAVE_SYSLOG_H
- gchar* convmsg;
- int syslog_pri = LOG_DEBUG;
-#endif
+ GLogLevelFlags loglevel;
if (!gconf_log_debug_messages &&
pri == GCL_DEBUG)
return;
-
- va_start (args, fmt);
- msg = g_strdup_vprintf(fmt, args);
- va_end (args);
-#ifdef HAVE_SYSLOG_H
- if (gconf_daemon_mode)
+ switch (pri)
{
- switch (pri)
- {
- case GCL_EMERG:
- syslog_pri = LOG_EMERG;
- break;
-
- case GCL_ALERT:
- syslog_pri = LOG_ALERT;
- break;
-
- case GCL_CRIT:
- syslog_pri = LOG_CRIT;
- break;
-
- case GCL_ERR:
- syslog_pri = LOG_ERR;
- break;
-
- case GCL_WARNING:
- syslog_pri = LOG_WARNING;
- break;
-
- case GCL_NOTICE:
- syslog_pri = LOG_NOTICE;
- break;
-
- case GCL_INFO:
- syslog_pri = LOG_INFO;
- break;
-
- case GCL_DEBUG:
- syslog_pri = LOG_DEBUG;
- break;
-
- default:
- g_assert_not_reached();
- break;
- }
-
- convmsg = g_locale_from_utf8 (msg, -1, NULL, NULL, NULL);
- if (!convmsg)
- syslog (syslog_pri, "%s", msg);
- else
- {
- syslog (syslog_pri, "%s", convmsg);
- g_free (convmsg);
- }
+ case GCL_EMERG:
+ case GCL_ALERT:
+ case GCL_CRIT:
+ loglevel = G_LOG_LEVEL_ERROR;
+ break;
+ case GCL_ERR:
+ loglevel = G_LOG_LEVEL_CRITICAL;
+ break;
+ case GCL_WARNING:
+ loglevel = G_LOG_LEVEL_WARNING;
+ break;
+ case GCL_NOTICE:
+ loglevel = G_LOG_LEVEL_MESSAGE;
+ break;
+ case GCL_INFO:
+ loglevel = G_LOG_LEVEL_INFO;
+ break;
+ case GCL_DEBUG:
+ loglevel = G_LOG_LEVEL_DEBUG;
+ break;
+ default:
+ g_assert_not_reached();
+ break;
}
- else
-#endif
- {
- switch (pri)
- {
- case GCL_EMERG:
- case GCL_ALERT:
- case GCL_CRIT:
- case GCL_ERR:
- case GCL_WARNING:
- g_printerr ("%s\n", msg);
- break;
-
- case GCL_NOTICE:
- case GCL_INFO:
- case GCL_DEBUG:
- g_print ("%s\n", msg);
- break;
- default:
- g_assert_not_reached();
- break;
- }
- }
-
- g_free(msg);
+ va_start (args, fmt);
+ g_logv (G_LOG_DOMAIN, loglevel, fmt, args);
+ va_end (args);
}
/*
diff -Nur -x '*.orig' -x '*~' gconf-2.21.1/gconf/gconf-sources.c gconf-2.21.1.new/gconf/gconf-sources.c
--- gconf-2.21.1/gconf/gconf-sources.c 2008-01-08 15:29:55.000000000 +0100
+++ gconf-2.21.1.new/gconf/gconf-sources.c 2008-01-14 12:06:52.000000000 +0100
@@ -407,20 +407,20 @@
if (source->flags & GCONF_SOURCE_ALL_WRITEABLE)
{
some_writable = TRUE;
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a writable configuration source at position %d"),
source->address, i);
}
else if (source->flags & GCONF_SOURCE_NEVER_WRITEABLE)
{
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a read-only configuration source at position %d"),
source->address, i);
}
else
{
some_writable = TRUE;
- gconf_log (GCL_INFO,
+ gconf_log (GCL_DEBUG,
_("Resolved address \"%s\" to a partially writable configuration source at position %d"),
source->address, i);
}
Loading…
Cancel
Save