Bug 686 - signame.c should include unistd.h (when available)
signame.c should include unistd.h (when available)
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.12
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-17 05:52 MST by Gustavo Zacarias
Modified: 2015-03-21 19:16 MDT (History)
0 users

See Also:


Attachments
Proposed fix (856 bytes, patch)
2015-02-17 05:52 MST, Gustavo Zacarias
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Zacarias 2015-02-17 05:52:14 MST
Created attachment 443 [details]
Proposed fix

signame.c uses sudo_compat.h which in turn uses gid_t definitions that are normally defined in unistd.h
This doesn't seem to cause issues with (e)glibc systems, but it does break uClibc-based builds:

----------

libtool: compile:  /home/gustavoz/b/sec/output/host/usr/bin/mips-buildroot-linux-uclibc-gcc -c -I../../include -I../.. -I. -I../.. -D__STDC_WANT_LIB_EXT1__=1 -Os -fvisibility=hidden -D_GNU_SOURCE -D_PATH_SUDO_CONF=\"/etc/sudo.conf\" signame.c  -fPIC -DPIC -o .libs/signame.o
In file included from signame.c:3:0:
../../include/sudo_compat.h:347:1: warning: parameter names (without types) in function declaration [enabled by default]
 int setresgid(gid_t, gid_t, gid_t);
 ^
../../include/sudo_compat.h:351:15: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
               ^
../../include/sudo_compat.h:351:24: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
                        ^
../../include/sudo_compat.h:351:33: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
                                 ^
Makefile:458: recipe for target 'signame.lo' failed
make[2]: *** [signame.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/gustavoz/b/sec/output/build/sudo-1.8.12/lib/util'
Makefile:90: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/gustavoz/b/sec/output/build/sudo-1.8.12'
package/pkg-generic.mk:182: recipe for target '/home/gustavoz/b/sec/output/build/sudo-1.8.12/.stamp_built' failed
make: *** [/home/gustavoz/b/sec/output/build/sudo-1.8.12/.stamp_built] Error 2

---------
Comment 1 Todd C. Miller 2015-02-17 06:22:53 MST
I've committed the diff, thanks.  The same thing applies to siglist.c but uClibc probably has strsignal() so it doesn't affect you.
Comment 2 Todd C. Miller 2015-03-21 19:16:49 MDT
Fixed in sudo 1.8.13, available now.