Bug 96207 - Comments of a sockaddr_un structure could confuse one
Summary: Comments of a sockaddr_un structure could confuse one
Status: Closed Overcome By Events
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Sergio Carlavilla Delgado
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-23 16:50 UTC by Rostislav Krasny
Modified: 2023-09-09 09:27 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rostislav Krasny 2006-04-23 16:50:14 UTC
In RELENG_6 (and others) a sys/un.h has following definitions:

/*
 * Definitions for UNIX IPC domain.
 */
struct sockaddr_un {
        unsigned char   sun_len;        /* sockaddr len including null */
        sa_family_t     sun_family;     /* AF_UNIX */
        char    sun_path[104];          /* path name (gag) */
};

/* actual length of an initialized sockaddr_un */
#define SUN_LEN(su) \
        (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))

Comments of the sockaddr_un definition, together with the SUN_LEN(su)
definition, could confuse one. For example my first thought was that
there is a bug in the SUN_LEN(su) definition. About 9 years ago the
same confusion happened in the NetBSD project. Read a "SUN_LEN()
definition change" thread:

http://mail-index.netbsd.org/tech-kern/1997/02/

and commit logs of revisions 1.14 and 1.15:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/un.h

Back to FreeBSD, I think the "/* sockaddr len including null */"
should be changed to "/* sockaddr_un len without NUL */"
and the "/* path name (gag) */" should be changed to
"/* NUL-terminated path name */". The unix(4) manual page already
gives the right information about that.

Fix: 

Already in the description
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:36 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Sergio Carlavilla Delgado freebsd_committer freebsd_triage 2023-09-09 09:27:55 UTC
It's been a long time since this PR was sent.
I'm going to close it and mark it as overcome by events.