]>
Commit | Line | Data |
---|---|---|
c6060300 MT |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.344 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.344 | |
11 | Problem: Problem with GUI startup related to XInitThreads. | |
12 | Solution: Use read() and write() instead of fputs() and fread(). (James | |
13 | Vega) | |
14 | Files: src/gui.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.343/src/gui.c 2011-09-14 19:04:35.000000000 +0200 | |
18 | --- src/gui.c 2011-10-20 21:23:43.000000000 +0200 | |
19 | *************** | |
20 | *** 212,218 **** | |
21 | int status; | |
22 | int exit_status; | |
23 | pid_t pid = -1; | |
24 | - FILE *parent_file; | |
25 | ||
26 | /* Setup a pipe between the child and the parent, so that the parent | |
27 | * knows when the child has done the setsid() call and is allowed to | |
28 | --- 212,217 ---- | |
29 | *************** | |
30 | *** 290,308 **** | |
31 | gui_mch_forked(); | |
32 | # endif | |
33 | ||
34 | - if (!pipe_error) | |
35 | - parent_file = fdopen(pipefd[1], "w"); | |
36 | - else | |
37 | - parent_file = NULL; | |
38 | - | |
39 | /* Try to start the GUI */ | |
40 | gui_attempt_start(); | |
41 | ||
42 | /* Notify the parent */ | |
43 | ! if (parent_file != NULL) | |
44 | { | |
45 | ! fputs(gui.in_use ? "ok" : "fail", parent_file); | |
46 | ! fclose(parent_file); | |
47 | } | |
48 | ||
49 | /* If we failed to start the GUI, exit now. */ | |
50 | --- 289,305 ---- | |
51 | gui_mch_forked(); | |
52 | # endif | |
53 | ||
54 | /* Try to start the GUI */ | |
55 | gui_attempt_start(); | |
56 | ||
57 | /* Notify the parent */ | |
58 | ! if (!pipe_error) | |
59 | { | |
60 | ! if (gui.in_use) | |
61 | ! write_eintr(pipefd[1], "ok", 3); | |
62 | ! else | |
63 | ! write_eintr(pipefd[1], "fail", 5); | |
64 | ! close(pipefd[1]); | |
65 | } | |
66 | ||
67 | /* If we failed to start the GUI, exit now. */ | |
68 | *************** | |
69 | *** 323,339 **** | |
70 | static int | |
71 | gui_read_child_pipe(int fd) | |
72 | { | |
73 | ! size_t bytes_read; | |
74 | ! FILE *file; | |
75 | ! char buffer[10]; | |
76 | ! | |
77 | ! file = fdopen(fd, "r"); | |
78 | ! if (!file) | |
79 | return GUI_CHILD_IO_ERROR; | |
80 | ! | |
81 | ! bytes_read = fread(buffer, sizeof(char), sizeof(buffer)-1, file); | |
82 | ! buffer[bytes_read] = '\0'; | |
83 | ! fclose(file); | |
84 | if (strcmp(buffer, "ok") == 0) | |
85 | return GUI_CHILD_OK; | |
86 | return GUI_CHILD_FAILED; | |
87 | --- 320,335 ---- | |
88 | static int | |
89 | gui_read_child_pipe(int fd) | |
90 | { | |
91 | ! long bytes_read; | |
92 | ! #define READ_BUFFER_SIZE 10 | |
93 | ! char buffer[READ_BUFFER_SIZE]; | |
94 | ! | |
95 | ! bytes_read = read_eintr(fd, buffer, READ_BUFFER_SIZE - 1); | |
96 | ! #undef READ_BUFFER_SIZE | |
97 | ! close(fd); | |
98 | ! if (bytes_read < 0) | |
99 | return GUI_CHILD_IO_ERROR; | |
100 | ! buffer[bytes_read] = NUL; | |
101 | if (strcmp(buffer, "ok") == 0) | |
102 | return GUI_CHILD_OK; | |
103 | return GUI_CHILD_FAILED; | |
104 | *** ../vim-7.3.343/src/version.c 2011-10-20 21:09:25.000000000 +0200 | |
105 | --- src/version.c 2011-10-20 21:27:31.000000000 +0200 | |
106 | *************** | |
107 | *** 716,717 **** | |
108 | --- 716,719 ---- | |
109 | { /* Add new patch number below this line */ | |
110 | + /**/ | |
111 | + 344, | |
112 | /**/ | |
113 | ||
114 | -- | |
115 | From "know your smileys": | |
116 | *<|:-) Santa Claus (Ho Ho Ho) | |
117 | ||
118 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
119 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
120 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
121 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |