diff options
author | Karel Klic <kklic@redhat.com> | 2011-05-02 20:29:32 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2011-05-02 20:29:32 +0200 |
commit | c8eaac58e73d67fa1e05b419ec7f3f51afd226bb (patch) | |
tree | 59b70a52ce244cb28cae5a92e5e8259f9e2fce2a /src | |
parent | 21bb65c863a5774600b96c7ba908c2482321c050 (diff) | |
parent | 6b9950f592cc646ce01dced25cd88b2f3c46034b (diff) | |
download | abrt-c8eaac58e73d67fa1e05b419ec7f3f51afd226bb.tar.gz abrt-c8eaac58e73d67fa1e05b419ec7f3f51afd226bb.tar.xz abrt-c8eaac58e73d67fa1e05b419ec7f3f51afd226bb.zip |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src')
-rw-r--r-- | src/gui-gtk/abrt-gtk.c | 7 | ||||
-rw-r--r-- | src/gui-gtk/main.c | 27 | ||||
-rw-r--r-- | src/gui-wizard-gtk/wizard.c | 6 |
3 files changed, 31 insertions, 9 deletions
diff --git a/src/gui-gtk/abrt-gtk.c b/src/gui-gtk/abrt-gtk.c index dc5aa5aa..61c5c4f9 100644 --- a/src/gui-gtk/abrt-gtk.c +++ b/src/gui-gtk/abrt-gtk.c @@ -44,7 +44,14 @@ enum void add_directory_to_dirlist(const char *dirname) { + /* Silently ignore *any* errors, not only EACCES. + * We saw "lock file is locked by process PID" error + * when we raced with wizard. + */ + int sv_logmode = logmode; + logmode = 0; struct dump_dir *dd = dd_opendir(dirname, DD_OPEN_READONLY | DD_FAIL_QUIETLY_EACCES); + logmode = sv_logmode; if (!dd) return; diff --git a/src/gui-gtk/main.c b/src/gui-gtk/main.c index ec2904b1..ee19ac8c 100644 --- a/src/gui-gtk/main.c +++ b/src/gui-gtk/main.c @@ -94,6 +94,7 @@ static void init_notify(void) else { close_on_exec_on(inotify_fd); + ndelay_on(inotify_fd); VERB1 log("Adding inotify watch to glib main loop"); channel_inotify = g_io_channel_unix_new(inotify_fd); channel_inotify_event_id = g_io_add_watch(channel_inotify, @@ -103,6 +104,7 @@ static void init_notify(void) } } +#if 0 // UNUSED static void close_notify(void) { if (inotify_fd >= 0) @@ -117,15 +119,25 @@ static void close_notify(void) //VERB1 log("Done"); } } +#endif /* Inotify handler */ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpointer ptr_unused) { - /* We don't bother reading inotify fd. We simply close and reopen it. - * This happens rarely enough to not bother making it efficient. + /* Since dump dir creation usually involves directory rename as a last step, + * we end up rescanning twice. A small wait after first inotify event + * usually allows to avoid this. */ - close_notify(); - init_notify(); + usleep(10*1000); + + /* We read inotify events, but don't analyze them */ + gchar buf[sizeof(struct inotify_event) + PATH_MAX + 64]; + gsize bytes_read; + while (g_io_channel_read(gio, buf, sizeof(buf), &bytes_read) == G_IO_ERROR_NONE + && bytes_read > 0 + ) { + continue; + } rescan_and_refresh(); @@ -219,6 +231,9 @@ int main(int argc, char **argv) unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose)); + char *pfx = getenv("ABRT_PROG_PREFIX"); + if (pfx && string_to_bool(pfx)) + msg_prefix = PROGNAME; if (opts & OPT_p) { msg_prefix = PROGNAME; @@ -254,8 +269,8 @@ int main(int argc, char **argv) xpipe(s_signal_pipe); close_on_exec_on(s_signal_pipe[0]); close_on_exec_on(s_signal_pipe[1]); - ndelay_off(s_signal_pipe[0]); - ndelay_off(s_signal_pipe[1]); + ndelay_on(s_signal_pipe[0]); + ndelay_on(s_signal_pipe[1]); signal(SIGCHLD, handle_signal); g_io_add_watch(g_io_channel_unix_new(s_signal_pipe[0]), G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP | G_IO_NVAL, diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index ee6c3c39..6e3bec69 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -829,9 +829,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g } } - /* Inform abrt-gui that it is a good idea to rescan the directory */ - kill(getppid(), SIGCHLD); - /* Stop if exit code is not 0, or no more commands */ if (retval != 0 || spawn_next_command_in_evd(evd) < 0 @@ -839,6 +836,9 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval); //append_to_textview(evd->tv_log, msg); + /* Inform abrt-gui that it is a good idea to rescan the directory */ + kill(getppid(), SIGCHLD); + for (;;) { if (!evd->more_events) |