[PATCH] Mingw: verify both ends of the pipe () call

Subsystems: the rest

DORMANTno replies

6 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH] Mingw: verify both ends of the pipe () call

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:06:19

From: jfmc <redacted>

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
 		return -1;
 	}
 	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
 		return -1;

--
https://github.com/git/git/pull/168

Re: [PATCH] Mingw: verify both ends of the pipe () call

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:06:19

Hi all,

On 2015-08-27 17:55, Johannes Schindelin wrote:
From: jfmc <redacted>

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
For what it's worth: this is my first submitGit submission! ;-)

Ciao,
Dscho

Re: [PATCH] Mingw: verify both ends of the pipe () call

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:06:19

Johannes Schindelin wrote:
From: jfmc <redacted>
This means the name shown by git shortlog would be jfmc instead of
Jose F. Morales.  Intended?
The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Jonathan Nieder <redacted>

This is an old one --- more than 5 years old (since v1.7.0-rc0~86^2~4
"Windows: simplify the pipe(2) implementation", 2010-01-15).  Thanks
for catching it.

Regards,
Jonathan

(patch kept unsnipped for reference)
quoted hunk
diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
 		return -1;
 	}
 	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
 		return -1;

--
https://github.com/git/git/pull/168

Re: [PATCH] Mingw: verify both ends of the pipe () call

From: Johannes Sixt <hidden>
Date: 2016-06-15 23:06:19

Am 27.08.2015 um 23:50 schrieb Jonathan Nieder:
Johannes Schindelin wrote:
quoted
From: jfmc <redacted>
This means the name shown by git shortlog would be jfmc instead of
Jose F. Morales.  Intended?
quoted
The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
  compat/mingw.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Jonathan Nieder <redacted>

This is an old one --- more than 5 years old (since v1.7.0-rc0~86^2~4
"Windows: simplify the pipe(2) implementation", 2010-01-15).  Thanks
for catching it.
Ouch! Thanks for cleaning up the mess I left behind.

-- Hannes
Regards,
Jonathan

(patch kept unsnipped for reference)
quoted
diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
  		return -1;
  	}
  	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
  		close(filedes[0]);
  		CloseHandle(h[1]);
  		return -1;

[PATCH v2] Mingw: verify both ends of the pipe () call

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:06:19

From: Jose F. Morales <redacted>

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <redacted>
Signed-off-by: Johannes Schindelin <redacted>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
 		return -1;
 	}
 	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
 		return -1;

--
https://github.com/git/git/pull/168

Re: [PATCH] Mingw: verify both ends of the pipe () call

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:06:19

Hi Jonathan,

On 2015-08-27 23:50, Jonathan Nieder wrote:
Johannes Schindelin wrote:
quoted
From: jfmc <redacted>
This means the name shown by git shortlog would be jfmc instead of
Jose F. Morales.  Intended?
Fixed in v2 ;-)

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help