Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Jul 2024 08:43:57 +0000
From:      bugzilla-noreply@freebsd.org
To:        doc@FreeBSD.org
Subject:   [Bug 96207] Comments of a sockaddr_un structure could confuse one
Message-ID:  <bug-96207-9-Ot2OAJabHZ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-96207-9@https.bugs.freebsd.org/bugzilla/>
References:  <bug-96207-9@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D96207

Amanda Steele <puzzlingcoalore@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |puzzlingcoalore@gmail.com

--- Comment #3 from Amanda Steele <puzzlingcoalore@gmail.com> ---
(In reply to Rostislav Krasny from comment #0)https://scratchgeometrydash.c=
om
Change the comment /* sockaddr len including null */ to /* sockaddr_un len
without NUL */.
Change the comment /* path name (gag) */ to /* NUL-terminated path name */.
These changes align with the correct interpretation of the sockaddr_un
structure and the SUN_LEN(su) macro, as they clarify the intent and the
behavior of the code.

Here is the updated sockaddr_un structure with the revised comments:
/*
 * Definitions for UNIX IPC domain.
 */
struct sockaddr_un {
    unsigned char   sun_len;        /* sockaddr_un len without NUL */
    sa_family_t     sun_family;     /* AF_UNIX */
    char            sun_path[104];  /* NUL-terminated path name */
};

/* actual length of an initialized sockaddr_un */
#define SUN_LEN(su) \
    (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
This should clarify the intended usage and prevent misunderstandings for fu=
ture
developers working with this code.

To make these changes effective in the FreeBSD project, you would typically:

Propose the changes through the appropriate FreeBSD mailing list or bug
tracker.
Provide a patch with the updated comments.
Reference the discussion and the rationale behind the change to explain the
reasoning to other developers and maintainers.
The links to the NetBSD discussion and commit logs can serve as additional
context to support your proposal.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-96207-9-Ot2OAJabHZ>