summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.344
blob: d2bb1dbe2b044351d2297cdc43ef9faf6027da44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
To: vim_dev@googlegroups.com
Subject: Patch 7.3.344
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.344
Problem:    Problem with GUI startup related to XInitThreads.
Solution:   Use read() and write() instead of fputs() and fread(). (James
	    Vega)
Files:	    src/gui.c


*** ../vim-7.3.343/src/gui.c	2011-09-14 19:04:35.000000000 +0200
--- src/gui.c	2011-10-20 21:23:43.000000000 +0200
***************
*** 212,218 ****
      int		status;
      int		exit_status;
      pid_t	pid = -1;
-     FILE	*parent_file;
  
      /* Setup a pipe between the child and the parent, so that the parent
       * knows when the child has done the setsid() call and is allowed to
--- 212,217 ----
***************
*** 290,308 ****
      gui_mch_forked();
  # endif
  
-     if (!pipe_error)
- 	parent_file = fdopen(pipefd[1], "w");
-     else
- 	parent_file = NULL;
- 
      /* Try to start the GUI */
      gui_attempt_start();
  
      /* Notify the parent */
!     if (parent_file != NULL)
      {
! 	fputs(gui.in_use ? "ok" : "fail", parent_file);
! 	fclose(parent_file);
      }
  
      /* If we failed to start the GUI, exit now. */
--- 289,305 ----
      gui_mch_forked();
  # endif
  
      /* Try to start the GUI */
      gui_attempt_start();
  
      /* Notify the parent */
!     if (!pipe_error)
      {
! 	if (gui.in_use)
! 	    write_eintr(pipefd[1], "ok", 3);
! 	else
! 	    write_eintr(pipefd[1], "fail", 5);
! 	close(pipefd[1]);
      }
  
      /* If we failed to start the GUI, exit now. */
***************
*** 323,339 ****
      static int
  gui_read_child_pipe(int fd)
  {
!     size_t	bytes_read;
!     FILE	*file;
!     char	buffer[10];
! 
!     file = fdopen(fd, "r");
!     if (!file)
  	return GUI_CHILD_IO_ERROR;
! 
!     bytes_read = fread(buffer, sizeof(char), sizeof(buffer)-1, file);
!     buffer[bytes_read] = '\0';
!     fclose(file);
      if (strcmp(buffer, "ok") == 0)
  	return GUI_CHILD_OK;
      return GUI_CHILD_FAILED;
--- 320,335 ----
      static int
  gui_read_child_pipe(int fd)
  {
!     long	bytes_read;
! #define READ_BUFFER_SIZE 10
!     char	buffer[READ_BUFFER_SIZE];
! 
!     bytes_read = read_eintr(fd, buffer, READ_BUFFER_SIZE - 1);
! #undef READ_BUFFER_SIZE
!     close(fd);
!     if (bytes_read < 0)
  	return GUI_CHILD_IO_ERROR;
!     buffer[bytes_read] = NUL;
      if (strcmp(buffer, "ok") == 0)
  	return GUI_CHILD_OK;
      return GUI_CHILD_FAILED;
*** ../vim-7.3.343/src/version.c	2011-10-20 21:09:25.000000000 +0200
--- src/version.c	2011-10-20 21:27:31.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     344,
  /**/

-- 
From "know your smileys":
 *<|:-)	Santa Claus (Ho Ho Ho)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///