mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
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:
parent
a922dadde0
commit
5429690467
@ -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>
|
||||
|
||||
* configure.in: fix configure.in since GTK no longer gives us
|
||||
|
@ -77,7 +77,12 @@ main (int argc, char **argv)
|
||||
act.sa_handler = SIG_IGN;
|
||||
act.sa_mask = empty_mask;
|
||||
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]);
|
||||
|
||||
|
45
src/util.c
45
src/util.c
@ -19,12 +19,15 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
static gboolean is_verbose = FALSE;
|
||||
static gboolean is_debugging = FALSE;
|
||||
@ -36,23 +39,43 @@ ensure_logfile (void)
|
||||
{
|
||||
if (logfile == NULL)
|
||||
{
|
||||
const char *dir;
|
||||
char *str;
|
||||
char *filename = NULL;
|
||||
char *tmpl;
|
||||
int fd;
|
||||
GError *err;
|
||||
|
||||
dir = g_get_home_dir ();
|
||||
str = g_strconcat (dir, "/", "metacity.log", NULL);
|
||||
tmpl = g_strdup_printf ("metacity-%d-debug-log-XXXXXX",
|
||||
(int) getpid ());
|
||||
|
||||
/* we want to replace not truncate any old logfile */
|
||||
unlink (str);
|
||||
err = NULL;
|
||||
fd = g_file_open_tmp (tmpl,
|
||||
&filename,
|
||||
&err);
|
||||
|
||||
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");
|
||||
|
||||
logfile = fopen (str, "w");
|
||||
|
||||
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
|
||||
meta_verbose ("Opened log file %s\n", str);
|
||||
{
|
||||
g_print (_("Opened log file %s\n"), filename);
|
||||
}
|
||||
|
||||
g_free (str);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user