diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-06-02 18:20:25 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-06-02 18:20:25 +0000 |
commit | 5f5ab2384c4b5de5be30125ad44fa600e4f6ad5c (patch) | |
tree | 947a394589ca332f3bf579657ead9ec88ebecaf2 | |
parent | 6e6bbbd4d5441b6c6393c42d575bf3a308c2ba5d (diff) | |
download | glib-5f5ab2384c4b5de5be30125ad44fa600e4f6ad5c.tar.gz glib-5f5ab2384c4b5de5be30125ad44fa600e4f6ad5c.tar.bz2 glib-5f5ab2384c4b5de5be30125ad44fa600e4f6ad5c.zip |
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.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-12 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 10 | ||||
-rw-r--r-- | glib/gspawn.c | 35 |
7 files changed, 89 insertions, 6 deletions
@@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ab2226ddb..565fb8f66 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index ab2226ddb..565fb8f66 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ab2226ddb..565fb8f66 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ab2226ddb..565fb8f66 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ab2226ddb..565fb8f66 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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> * glib/giochannel.c (g_io_error_get_from_g_error): Put diff --git a/glib/gspawn.c b/glib/gspawn.c index 2af786db4..77d44fb2d 100644 --- a/glib/gspawn.c +++ b/glib/gspawn.c @@ -148,7 +148,7 @@ read_data (GString *str, again: - bytes = read (fd, &buf, 4096); + bytes = read (fd, buf, 4096); if (bytes == 0) 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 write_err_and_exit (gint fd, gint msg) { gint en = errno; - write (fd, &msg, sizeof(msg)); - write (fd, &en, sizeof(en)); + write_all (fd, &msg, sizeof(msg)); + write_all (fd, &en, sizeof(en)); _exit (1); } @@ -1081,8 +1104,8 @@ fork_exec_with_pipes (gboolean intermediate_child, if (grandchild_pid < 0) { /* report -1 as child PID */ - write (child_pid_report_pipe[1], &grandchild_pid, - sizeof(grandchild_pid)); + write_all (child_pid_report_pipe[1], &grandchild_pid, + sizeof(grandchild_pid)); write_err_and_exit (child_err_report_pipe[1], CHILD_FORK_FAILED); @@ -1107,7 +1130,7 @@ fork_exec_with_pipes (gboolean intermediate_child, } 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]); _exit (0); |