This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: [PATCH,HURD] sendto: do not crash when addr is NULL


Put the name of a local variable in all caps when mentioning it in the log
entry or comments.

Initializing ERR at the top is confusingly subtle.
Instead, you make the code that actually cares look like:

	if (addr == NULL || addr->sun_family == AF_LOCAL)
	  err = 0;
	else
	  err = __socket_create_address (...);
	if (! err)
	  ...

It looks like the existing code also has a leak of APORT in the case where
HURD_DPORT_USE fails (i.e. invalid fd).  So you should reorganize in some
way that fixes that too.

It might be simplest just to move the creation of the address port (both
the AF_LOCAL case and the default case) into a subroutine and just call
that inside HURD_DPORT_USE.  It means that the descriptor structure and
port are kept alive around the AF_LOCAL case's calls, but that seems OK.


Thanks,
Roland


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