mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com> Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825) * glib/gspawn.c (read_data): Don't read() into '&buf', while this is technically okay - it is clearer as just 'buf'. (write_all): New helper function that handles write() interrupts. (write_err_and_exit): Use write_all() instead of write(). (fork_exec_with_pipes): Same here.
This commit is contained in:
parent
6e6bbbd4d5
commit
5f5ab2384c
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Mon Jun 2 14:18:21 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
Patch from Jeffrey Stedfast <fejj@ximian.com> (#104825)
|
||||||
|
|
||||||
|
* glib/gspawn.c (read_data): Don't read() into '&buf', while this
|
||||||
|
is technically okay - it is clearer as just 'buf'.
|
||||||
|
(write_all): New helper function that handles write() interrupts.
|
||||||
|
(write_err_and_exit): Use write_all() instead of write().
|
||||||
|
(fork_exec_with_pipes): Same here.
|
||||||
|
|
||||||
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
Sun Jun 1 09:42:36 2003 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
* glib/giochannel.c (g_io_error_get_from_g_error): Put
|
||||||
|
@ -148,7 +148,7 @@ read_data (GString *str,
|
|||||||
|
|
||||||
again:
|
again:
|
||||||
|
|
||||||
bytes = read (fd, &buf, 4096);
|
bytes = read (fd, buf, 4096);
|
||||||
|
|
||||||
if (bytes == 0)
|
if (bytes == 0)
|
||||||
return READ_EOF;
|
return READ_EOF;
|
||||||
@ -793,13 +793,36 @@ exec_err_to_g_error (gint en)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gssize
|
||||||
|
write_all (gint fd, gconstpointer vbuf, gsize to_write)
|
||||||
|
{
|
||||||
|
gchar *buf = (gchar *) vbuf;
|
||||||
|
|
||||||
|
while (to_write > 0)
|
||||||
|
{
|
||||||
|
gssize count = write (fd, buf, to_write);
|
||||||
|
if (count < 0)
|
||||||
|
{
|
||||||
|
if (errno != EINTR)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
to_write -= count;
|
||||||
|
buf += count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_err_and_exit (gint fd, gint msg)
|
write_err_and_exit (gint fd, gint msg)
|
||||||
{
|
{
|
||||||
gint en = errno;
|
gint en = errno;
|
||||||
|
|
||||||
write (fd, &msg, sizeof(msg));
|
write_all (fd, &msg, sizeof(msg));
|
||||||
write (fd, &en, sizeof(en));
|
write_all (fd, &en, sizeof(en));
|
||||||
|
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
@ -1081,7 +1104,7 @@ fork_exec_with_pipes (gboolean intermediate_child,
|
|||||||
if (grandchild_pid < 0)
|
if (grandchild_pid < 0)
|
||||||
{
|
{
|
||||||
/* report -1 as child PID */
|
/* report -1 as child PID */
|
||||||
write (child_pid_report_pipe[1], &grandchild_pid,
|
write_all (child_pid_report_pipe[1], &grandchild_pid,
|
||||||
sizeof(grandchild_pid));
|
sizeof(grandchild_pid));
|
||||||
|
|
||||||
write_err_and_exit (child_err_report_pipe[1],
|
write_err_and_exit (child_err_report_pipe[1],
|
||||||
@ -1107,7 +1130,7 @@ fork_exec_with_pipes (gboolean intermediate_child,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write (child_pid_report_pipe[1], &grandchild_pid, sizeof(grandchild_pid));
|
write_all (child_pid_report_pipe[1], &grandchild_pid, sizeof(grandchild_pid));
|
||||||
close_and_invalidate (&child_pid_report_pipe[1]);
|
close_and_invalidate (&child_pid_report_pipe[1]);
|
||||||
|
|
||||||
_exit (0);
|
_exit (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user