diff --git a/7.3.344 b/7.3.344 new file mode 100644 index 0000000..d2bb1db --- /dev/null +++ b/7.3.344 @@ -0,0 +1,121 @@ +To: vim_dev@googlegroups.com +Subject: Patch 7.3.344 +Fcc: outbox +From: Bram Moolenaar +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 ///