Skip to content

utmps_getutxent_r defined twice in utmps/utmpx.h #3

@OddBloke

Description

@OddBloke

When building utempter, we're seeing build failures like:

2025/05/09 17:12:25 WARN + make 'CFLAGS= -I/usr/include/utmps' 'LDLIBS=-Wl,--no-as-needed -lutmps -lskarnet -Wl,--as-needed'
2025/05/09 17:12:25 INFO cc -W -Wall -Waggregate-return -Wcast-align -Wconversion -Wdisabled-optimization -Wformat=2 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -I/usr/include/utmps  -std=gnu99  -DLIBEXECDIR=\"/usr/lib\"  -Wl,-z,relro -Wl,-stats   -fPIE -pie -Wl,-z,now -Wl,--no-as-needed -lutmps -lskarnet -Wl,--as-needed utempter.c -o utempter
2025/05/09 17:12:25 WARN In file included from /usr/include/utmps/utmp.h:6,
2025/05/09 17:12:25 WARN                  from utempter.c:36:
2025/05/09 17:12:25 WARN /usr/include/utmps/utmpx.h:85:12: error: conflicting types for 'utmps_getutxent_r'; have 'int(const struct utmpx *, struct utmpx *, struct utmpx **)'
2025/05/09 17:12:25 WARN    85 | extern int utmps_getutxent_r (struct utmpx const *, struct utmpx *, struct utmpx **) ;
2025/05/09 17:12:25 WARN       |            ^~~~~~~~~~~~~~~~~
2025/05/09 17:12:25 WARN /usr/include/utmps/utmpx.h:83:12: note: previous declaration of 'utmps_getutxent_r' with type 'int(struct utmpx *, struct utmpx **)'
2025/05/09 17:12:25 WARN    83 | extern int utmps_getutxent_r (struct utmpx *, struct utmpx **) ;
2025/05/09 17:12:25 WARN       |            ^~~~~~~~~~~~~~~~~
2025/05/09 17:12:25 WARN make: *** [Makefile:64: utempter] Error 1

It looks to me like this is caused by the duplicated definitions here:

#ifdef _DEFAULT_SOURCE
extern int utmps_getutxent_r (struct utmpx *, struct utmpx **) ;
extern int utmps_getutxid_r (struct utmpx const *, struct utmpx *, struct utmpx **) ;
extern int utmps_getutxent_r (struct utmpx const *, struct utmpx *, struct utmpx **) ;
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions