try ignoring SIGXFSZ, though I'm not sure what that does exactly. I'm

2002-03-04  Havoc Pennington  <hp@pobox.com>

	* src/main.c (main): try ignoring SIGXFSZ, though I'm not
	sure what that does exactly. I'm hoping it gives me EFBIG.

	* src/util.c (ensure_logfile): log to a file in /tmp instead
	of to ~/metacity.log.
This commit is contained in:
Havoc Pennington 2002-03-05 02:43:22 +00:00 committed by Havoc Pennington
parent a922dadde0
commit 5429690467
3 changed files with 48 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2002-03-04 Havoc Pennington <hp@pobox.com>
* src/main.c (main): try ignoring SIGXFSZ, though I'm not
sure what that does exactly. I'm hoping it gives me EFBIG.
* src/util.c (ensure_logfile): log to a file in /tmp instead
of to ~/metacity.log.
2002-03-04 Havoc Pennington <hp@redhat.com> 2002-03-04 Havoc Pennington <hp@redhat.com>
* configure.in: fix configure.in since GTK no longer gives us * configure.in: fix configure.in since GTK no longer gives us

View File

@ -77,7 +77,12 @@ main (int argc, char **argv)
act.sa_handler = SIG_IGN; act.sa_handler = SIG_IGN;
act.sa_mask = empty_mask; act.sa_mask = empty_mask;
act.sa_flags = 0; act.sa_flags = 0;
sigaction (SIGPIPE, &act, 0); if (sigaction (SIGPIPE, &act, 0) < 0)
g_printerr ("Failed to register SIGPIPE handler: %s\n", strerror (errno));
#ifdef SIGXFSZ
if (sigaction (SIGXFSZ, &act, 0) < 0)
g_printerr ("Failed to register SIGXFSZ handler: %s\n", strerror (errno));
#endif
g_set_prgname (argv[0]); g_set_prgname (argv[0]);

View File

@ -19,12 +19,15 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <config.h>
#include "util.h" #include "util.h"
#include "main.h" #include "main.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <string.h>
static gboolean is_verbose = FALSE; static gboolean is_verbose = FALSE;
static gboolean is_debugging = FALSE; static gboolean is_debugging = FALSE;
@ -36,23 +39,43 @@ ensure_logfile (void)
{ {
if (logfile == NULL) if (logfile == NULL)
{ {
const char *dir; char *filename = NULL;
char *str; char *tmpl;
int fd;
GError *err;
dir = g_get_home_dir (); tmpl = g_strdup_printf ("metacity-%d-debug-log-XXXXXX",
str = g_strconcat (dir, "/", "metacity.log", NULL); (int) getpid ());
/* we want to replace not truncate any old logfile */ err = NULL;
unlink (str); fd = g_file_open_tmp (tmpl,
&filename,
&err);
logfile = fopen (str, "w"); g_free (tmpl);
if (err != NULL)
{
meta_warning (_("Failed to open debug log: %s\n"),
err->message);
g_error_free (err);
return;
}
logfile = fdopen (fd, "w");
if (logfile == NULL) if (logfile == NULL)
meta_warning ("Failed to open log file %s\n", str); {
meta_warning (_("Failed to fdopen() log file %s: %s\n"),
filename, strerror (errno));
close (fd);
}
else else
meta_verbose ("Opened log file %s\n", str); {
g_print (_("Opened log file %s\n"), filename);
}
g_free (str); g_free (filename);
} }
} }