Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#65558 closed defect (fixed)

tcp_wrappers: header file tcpd.h doesn't guard against multiple inclusion, potentially causing build errors in dependents

Reported by: mascguy (Christopher Nielsen) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc:
Port: tcp_wrappers

Description

While one might argue that dependent projects should avoid including the same header multiple times, that's not always easy to avoid. Hence the reason why headers include guards, preventing errors when that occurs.

One real-world example is openldap 2.6.x, when variant +wrappers is enabled:

In file included from util-int.c:950:
/opt/local/include/tcpd.h:20:16: error: redefinition of 'sockaddr_gen'
typedef struct sockaddr_gen {
               ^
../../include/lutil.h:24:11: note: '/opt/local/include/tcpd.h' included multiple times, additional include site here
# include <tcpd.h>
          ^
util-int.c:950:11: note: '/opt/local/include/tcpd.h' included multiple times, additional include site here
# include <tcpd.h>
          ^
/opt/local/include/tcpd.h:20:16: note: unguarded header; consider using #ifdef guards or #pragma once
typedef struct sockaddr_gen {
               ^

Patch said header, to include a guard.

Change History (2)

comment:1 Changed 2 years ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In 2085880447a0c5e2c3b5e0616f37a836cb03244f/macports-ports (master):

tcp_wrappers: add header guard
Fixes: #65558

comment:2 Changed 2 years ago by Christopher Nielsen <mascguy@…>

In 69a08ad8128af5e055dcf04c714e4fb5d214925b/macports-ports (master):

openldap-devel: enable wrappers by default

  • Now possible, with tcp_wrappers header guard added

See: #65558

Note: See TracTickets for help on using tickets.