This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PING: [PATCH] properly check error return from socket() and accept() calls


PING.

On Sat, Apr 3, 2010 at 10:37 AM, Ozkan Sezer <sezeroz@gmail.com> wrote:
> On Fri, Apr 2, 2010 at 11:46 AM, Ozkan Sezer <sezeroz@gmail.com> wrote:
>> Hi:
>>
>> socket() and accept() calls do not return "some negative value" on error,
>> they specifically return "-1". Therefore, the error return checks from
>> those calls must be done by checking equality to -1 not by being negative.
>> This is important for Win32 where the SOCKET type is actually unsigned
>> and the operating system has every right to return a value > INT_MAX and
>> < UINT_MAX and since gdb is using a signed int type for socket fd (which
>> is broken for Win64 where SOCKET type is uintptr_t, but that's for another
>> time), the negativity check may evaluate to true even if the socket() or
>> accept() call actually succeeded. The attached trivial patch fixes this as
>> described. For uniformity's sake, I also touched the files under sim/.
>> Please consider for applying. (The patch file has the ChangeLog. I don't
>> have write access.)
>>
>
> I seem to have missed a couple of places. Attached the updated patch.
>
> --
> Ozkan
>

Attachment: gdb_socket_err_checks.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]