Bug 488960 – gnome-terminal on Solaris 10 does not clean up utmpx on
authorChristian Persch <chpe@src.gnome.org>
Wed, 26 Nov 2008 15:26:40 +0000 (15:26 +0000)
committerChristian Persch <chpe@src.gnome.org>
Wed, 26 Nov 2008 15:26:40 +0000 (15:26 +0000)
exit (intermittent)

* gnome-pty-helper/gnome-pty-helper.c: (main):
* gnome-pty-helper/gnome-pty.h:
* src/pty.c: (_vte_pty_close): Add new GNOME_PTY_SYNCH operation to
gnome-pty-helper. Patch from Behdad.

svn path=/trunk/; revision=2197

ChangeLog
gnome-pty-helper/gnome-pty-helper.c
gnome-pty-helper/gnome-pty.h
src/pty.c

index 4654ae3..8fea097 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-11-26  Christian Persch  <chpe@gnome.org>
+
+       Bug 488960 – gnome-terminal on Solaris 10 does not clean up utmpx on
+       exit (intermittent)
+
+       * gnome-pty-helper/gnome-pty-helper.c: (main):
+       * gnome-pty-helper/gnome-pty.h:
+       * src/pty.c: (_vte_pty_close): Add new GNOME_PTY_SYNCH operation to
+       gnome-pty-helper. Patch from Behdad.
+
 2008-11-26  Christian Persch  <chpe@gnome.org>
 
        * src/vte.c: (vte_terminal_style_changed),
index f3d28c5..dcd3a10 100644 (file)
@@ -762,6 +762,13 @@ main (int argc, char *argv [])
                        }
                        close_pty_pair (tag);
                        break;
+
+               case GNOME_PTY_SYNCH:
+                       {
+                               int result = 0;
+                               n_write (STDIN_FILENO, &result, 1);
+                       }
+                       break;
                }
 
        }
index 53de25a..94f94f9 100644 (file)
@@ -11,7 +11,8 @@ typedef enum {
        GNOME_PTY_OPEN_PTY_LASTLOGWTMP,
        GNOME_PTY_OPEN_NO_DB_UPDATE,
        GNOME_PTY_RESET_TO_DEFAULTS,
-       GNOME_PTY_CLOSE_PTY
+       GNOME_PTY_CLOSE_PTY,
+       GNOME_PTY_SYNCH
 } GnomePtyOps;
 
 void *update_dbs         (int utmp, int wtmp, int lastlog, char *login_name, char *display_name, char *term_name);
index b91a279..ca426d4 100644 (file)
--- a/src/pty.c
+++ b/src/pty.c
@@ -1064,9 +1064,10 @@ _vte_pty_close(int pty)
                if (g_tree_lookup(_vte_pty_helper_map, GINT_TO_POINTER(pty))) {
                        /* Signal the helper that it needs to close its
                         * connection. */
-                       ops = GNOME_PTY_CLOSE_PTY;
                        tag = g_tree_lookup(_vte_pty_helper_map,
                                            GINT_TO_POINTER(pty));
+
+                       ops = GNOME_PTY_CLOSE_PTY;
                        if (n_write(_vte_pty_helper_tunnel,
                                    &ops, sizeof(ops)) != sizeof(ops)) {
                                return;
@@ -1075,6 +1076,14 @@ _vte_pty_close(int pty)
                                    &tag, sizeof(tag)) != sizeof(tag)) {
                                return;
                        }
+
+                       ops = GNOME_PTY_SYNCH;
+                       if (n_write(_vte_pty_helper_tunnel,
+                                   &ops, sizeof(ops)) != sizeof(ops)) {
+                               return;
+                       }
+                       n_read(_vte_pty_helper_tunnel, &ops, 1);
+
                        /* Remove the item from the map. */
                        g_tree_remove(_vte_pty_helper_map,
                                      GINT_TO_POINTER(pty));