Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-16 Thread Alvaro Herrera
Bruce Momjian wrote: Yes, I saw that yesterday and fixed it. I also did a dry run of backpatching and only 8.4 had conflicts, so I think we are good there. (This is like the readdir() fix all over again.) Once this is applied I will work on changing the libpq socket type to use portable

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-16 Thread Bruce Momjian
On Wed, Apr 16, 2014 at 10:34:55AM -0300, Alvaro Herrera wrote: Bruce Momjian wrote: Yes, I saw that yesterday and fixed it. I also did a dry run of backpatching and only 8.4 had conflicts, so I think we are good there. (This is like the readdir() fix all over again.) Once this is

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-16 Thread Bruce Momjian
On Fri, Apr 11, 2014 at 08:28:55AM -0400, Bruce Momjian wrote: On Fri, Apr 11, 2014 at 10:03:08AM +0530, Amit Kapila wrote: On Fri, Apr 11, 2014 at 10:00 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, Apr 10, 2014 at 5:21 PM, Bruce Momjian br...@momjian.us wrote: On Thu, Apr

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-16 Thread Bruce Momjian
On Fri, Apr 11, 2014 at 08:28:55AM -0400, Bruce Momjian wrote: Once this is applied I will work on changing the libpq socket type to use portable pgsocket, but I am not planning to backpatch that unless we find a bug. Attached is a follow up patch which stores socket values in libpq as

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-16 Thread Bruce Momjian
On Wed, Apr 16, 2014 at 11:22:28AM -0400, Bruce Momjian wrote: On Fri, Apr 11, 2014 at 08:28:55AM -0400, Bruce Momjian wrote: Once this is applied I will work on changing the libpq socket type to use portable pgsocket, but I am not planning to backpatch that unless we find a bug.

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-11 Thread Bruce Momjian
On Fri, Apr 11, 2014 at 10:03:08AM +0530, Amit Kapila wrote: On Fri, Apr 11, 2014 at 10:00 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, Apr 10, 2014 at 5:21 PM, Bruce Momjian br...@momjian.us wrote: On Thu, Apr 10, 2014 at 11:05:49AM +0530, Amit Kapila wrote: Ah, yes, good

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-10 Thread Bruce Momjian
On Thu, Apr 10, 2014 at 11:05:49AM +0530, Amit Kapila wrote: On Tue, Apr 8, 2014 at 11:32 PM, Bruce Momjian br...@momjian.us wrote: On Sun, Apr 6, 2014 at 11:45:59AM +0530, Amit Kapila wrote: In fact, this C program compiled by gcc on Debian issues no compiler warnings and returns 'hello',

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-10 Thread Amit Kapila
On Thu, Apr 10, 2014 at 5:21 PM, Bruce Momjian br...@momjian.us wrote: On Thu, Apr 10, 2014 at 11:05:49AM +0530, Amit Kapila wrote: Ah, yes, good point. This is going to require backpatching then. I also think so. I think it's better to use check like below, just for matter of consistency

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-10 Thread Amit Kapila
On Fri, Apr 11, 2014 at 10:00 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, Apr 10, 2014 at 5:21 PM, Bruce Momjian br...@momjian.us wrote: On Thu, Apr 10, 2014 at 11:05:49AM +0530, Amit Kapila wrote: Ah, yes, good point. This is going to require backpatching then. I also think so.

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-09 Thread Amit Kapila
On Tue, Apr 8, 2014 at 11:32 PM, Bruce Momjian br...@momjian.us wrote: On Sun, Apr 6, 2014 at 11:45:59AM +0530, Amit Kapila wrote: In fact, this C program compiled by gcc on Debian issues no compiler warnings and returns 'hello', showing that -1 and ~0 compare as equal: int

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-08 Thread Bruce Momjian
On Sun, Apr 6, 2014 at 11:45:59AM +0530, Amit Kapila wrote: On Tue, Apr 1, 2014 at 6:31 AM, Bruce Momjian br...@momjian.us wrote: I reviewed this patch and you are correct that we are not handling socket() and accept() returns properly on Windows. We were doing it properly in most place

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-04-06 Thread Amit Kapila
On Tue, Apr 1, 2014 at 6:31 AM, Bruce Momjian br...@momjian.us wrote: I reviewed this patch and you are correct that we are not handling socket() and accept() returns properly on Windows. We were doing it properly in most place in the backend, but your patch fixes the remaining places:

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-03-31 Thread Bruce Momjian
On Wed, Dec 25, 2013 at 01:35:15PM +0100, Joel Jacobson wrote: Hi, I've tried to fix some bugs reported by Andrey Karpov in an article at http://www.viva64.com/en/b/0227/ The value returned by socket() is unsigned on Windows and can thus not be checked if less than zero to detect an

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2014-03-05 Thread Alvaro Herrera
Joel Jacobson wrote: Hi, I've tried to fix some bugs reported by Andrey Karpov in an article at http://www.viva64.com/en/b/0227/ The value returned by socket() is unsigned on Windows and can thus not be checked if less than zero to detect an error, instead PGINVALID_SOCKET should be

Re: [HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2013-12-31 Thread Amit Kapila
On Wed, Dec 25, 2013 at 6:05 PM, Joel Jacobson j...@trustly.com wrote: Hi, I've tried to fix some bugs reported by Andrey Karpov in an article at http://www.viva64.com/en/b/0227/ The value returned by socket() is unsigned on Windows and can thus not be checked if less than zero to detect an

[HACKERS] [BUG FIX] Compare returned value by socket() against PGINVALID_SOCKET instead of 0

2013-12-25 Thread Joel Jacobson
Hi, I've tried to fix some bugs reported by Andrey Karpov in an article at http://www.viva64.com/en/b/0227/ The value returned by socket() is unsigned on Windows and can thus not be checked if less than zero to detect an error, instead PGINVALID_SOCKET should be used, which is hard-coded to -1