Subject: Re: Use of sun_len in AF_UNIX socket addresses
To: Christian Biere <christianbiere@gmx.de>
From: SODA Noriyuki <soda@sra.co.jp>
List: tech-net
Date: 10/18/2006 08:12:09
>>>>> On Wed, 11 Oct 2006 23:24:12 +0200,
      Christian Biere <christianbiere@gmx.de> said:

> But again, the main issue was the documentation. If those who care at all
> about this stuff prefer to keep sun_len and SUN_LEN(), so be it.

I believe we should keep both sun_len and SUN_LEN().

Is the latest version of the unix(4) man page OK for you?

Or, perhaps you want to add something like the following code fragment
in some section like PORTABILITY ISSUE?
	On systems which don't have the SUN_LEN() macro,
	the following definition is recommended,
	since using strlen((su)->sun_path) like our native SUN_LEN()
	implementation truncates the path on IRIX.

	#ifndef SUN_LEN
	#define SUN_LEN(su)	sizeof(struct(sockaddr_un))
	#endif
But this sort of description may be too much for a man page....

P.S.
Maybe we should change the strlcpy() line as you said in lib/34744,
though. e.g.
	if (strlcpy(sunx.sun_path, THE_PATH, sizeof(sunx.sun_path)) >=
	    sizeof(sunx.sun_path))
		errx(EXIT_FAILURE, "%s: too long socket name", THE_PATH);
-- 
soda