0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.3.344

Problem:    Problem with GUI startup related to XInitThreads.
Solution:   Use read() and write() instead of fputs() and fread(). (James
            Vega)
This commit is contained in:
Bram Moolenaar
2011-10-20 21:28:01 +02:00
parent c842748302
commit cd6fe97e6b
2 changed files with 16 additions and 18 deletions

View File

@@ -212,7 +212,6 @@ gui_do_fork()
int status; int status;
int exit_status; int exit_status;
pid_t pid = -1; pid_t pid = -1;
FILE *parent_file;
/* Setup a pipe between the child and the parent, so that the parent /* 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 * knows when the child has done the setsid() call and is allowed to
@@ -290,19 +289,17 @@ gui_do_fork()
gui_mch_forked(); gui_mch_forked();
# endif # endif
if (!pipe_error)
parent_file = fdopen(pipefd[1], "w");
else
parent_file = NULL;
/* Try to start the GUI */ /* Try to start the GUI */
gui_attempt_start(); gui_attempt_start();
/* Notify the parent */ /* Notify the parent */
if (parent_file != NULL) if (!pipe_error)
{ {
fputs(gui.in_use ? "ok" : "fail", parent_file); if (gui.in_use)
fclose(parent_file); 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. */ /* If we failed to start the GUI, exit now. */
@@ -323,17 +320,16 @@ gui_do_fork()
static int static int
gui_read_child_pipe(int fd) gui_read_child_pipe(int fd)
{ {
size_t bytes_read; long bytes_read;
FILE *file; #define READ_BUFFER_SIZE 10
char buffer[10]; char buffer[READ_BUFFER_SIZE];
file = fdopen(fd, "r"); bytes_read = read_eintr(fd, buffer, READ_BUFFER_SIZE - 1);
if (!file) #undef READ_BUFFER_SIZE
close(fd);
if (bytes_read < 0)
return GUI_CHILD_IO_ERROR; return GUI_CHILD_IO_ERROR;
buffer[bytes_read] = NUL;
bytes_read = fread(buffer, sizeof(char), sizeof(buffer)-1, file);
buffer[bytes_read] = '\0';
fclose(file);
if (strcmp(buffer, "ok") == 0) if (strcmp(buffer, "ok") == 0)
return GUI_CHILD_OK; return GUI_CHILD_OK;
return GUI_CHILD_FAILED; return GUI_CHILD_FAILED;

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
344,
/**/ /**/
343, 343,
/**/ /**/