NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/57871: CMSG_DATA uses u_char which is undefined when POSIX_C_SOURCE is set



>Number:         57871
>Category:       lib
>Synopsis:       CMSG_DATA uses u_char which is undefined when POSIX_C_SOURCE is set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 22 18:40:00 +0000 2024
>Originator:     Haelwenn (lanodan) Monnier
>Release:        9.3
>Organization:
>Environment:
NetBSD build 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug  4 15:30:37 UTC 2022  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
As seen in https://github.com/akash-akya/exile (commit 71a21be) where it fails with the following error (CC=clang for enough information):

```
$ mix compile
clang -Wall -Werror -Wno-unused-parameter -pedantic -std=c99 -O2 -D_POSIX_C_SOURCE=200809L c_src/spawner.c -o priv/spawner
c_src/spawner.c:72:17: error: expected expression
  memcpy((int *)CMSG_DATA(cmsg), fds, 3 * sizeof(int));
                ^
/usr/include/sys/socket.h:554:26: note: expanded from macro 'CMSG_DATA'
#define CMSG_DATA(cmsg) (__CASTV(u_char *, cmsg) + __CMSG_ASIZE)
                         ^
/usr/include/sys/cdefs.h:620:29: note: expanded from macro '__CASTV'
#define __CASTV(__dt, __st)     __CAST(__dt, __CAST(void *, __st))
                                ^
/usr/include/sys/cdefs.h:617:34: note: expanded from macro '__CAST'
#define __CAST(__dt, __st)      ((__dt)(__st))
                                      ^
c_src/spawner.c:72:17: error: use of undeclared identifier 'u_char'
/usr/include/sys/socket.h:554:34: note: expanded from macro 'CMSG_DATA'
#define CMSG_DATA(cmsg) (__CASTV(u_char *, cmsg) + __CMSG_ASIZE)
                                 ^
2 errors generated.
```
>How-To-Repeat:
$ git clone https://github.com/akash-akya/exile
$ git checkout 71a21be
$ clang -Wall -Werror -Wno-unused-parameter -pedantic -std=c99 -O2 -D_POSIX_C_SOURCE=200809L c_src/spawner.c -o priv/spawner
>Fix:



Home | Main Index | Thread Index | Old Index