Patchwork [c-hglib] hg_exitcode: reset the bytes_on_pipe after finish the read

login
register
mail settings
Submitter Iulian Stana
Date Sept. 23, 2013, 7:43 p.m.
Message ID <0f979fbe86d000fad5f1.1379965421@doppler>
Download mbox | patch
Permalink /patch/2611/
State Deferred
Headers show

Comments

Iulian Stana - Sept. 23, 2013, 7:43 p.m.
# HG changeset patch
# User Iulian Stana <julian.stana@gmail.com>
# Date 1379964910 -10800
#      Mon Sep 23 22:35:10 2013 +0300
# Node ID 0f979fbe86d000fad5f1807cfe7008d034c71483
# Parent  43bbd8b7a56b5a321bf073246225672ad7402461
hg_exitcode: reset the bytes_on_pipe after finish the read

There was a bug. After each reading you must deacrese the number of
bytes_on_pipe field. And I forgot to decrease this field in exitcode function.
Matt Mackall - Sept. 23, 2013, 7:49 p.m.
On Mon, 2013-09-23 at 22:43 +0300, Iulian Stana wrote:
> # HG changeset patch
> # User Iulian Stana <julian.stana@gmail.com>
> # Date 1379964910 -10800
> #      Mon Sep 23 22:35:10 2013 +0300
> # Node ID 0f979fbe86d000fad5f1807cfe7008d034c71483
> # Parent  43bbd8b7a56b5a321bf073246225672ad7402461
> hg_exitcode: reset the bytes_on_pipe after finish the read

Queued, thanks.

Patch

diff --git a/hglib/client.c b/hglib/client.c
--- a/hglib/client.c
+++ b/hglib/client.c
@@ -310,6 +310,7 @@ 
 	if (read(handle->p_read, &exitcode, sizeof(int)) < 0) {
 		return -1;
 	}
+	handle->bytes_on_pipe = 0;
 	handle->protect = 0;
 	return swap_uint32(exitcode);
 }