On (02/09/13 23:02), Jakub Hrozek wrote:
On Mon, Sep 02, 2013 at 07:12:51PM +0200, Lukas Slebodnik wrote:
ehlo,
I checked some manual pages, where [ug]?id types are used and each manual page suggest to include header file "sys/types.h". This header file was indirectly included in some files on linux, but it is not portable.
man getgid #include <unistd.h> #include <sys/types.h>
gid_t getgid(void); gid_t getegid(void);
man getpwuid #include <sys/types.h> #include <pwd.h>
struct passwd *getpwuid(uid_t uid);
I think the change is correct. The POSIX information I checked (http://pubs.opengroup.org/onlinepubs/009695399/basedefs/pwd.h.html for example) say that "The gid_t and uid_t types shall be defined as described in <sys/types.h>."
But I wonder if these are the only files that needed fixing? uid_t seems to be used all over the place..
yes just these two files.
Without this patch, We include "sys/types.h" in 10 header files and 59 "*.c" file.
src/providers/data_provider.h:32:#include <sys/types.h> src/providers/ldap/sdap_async.h:25:#include <sys/types.h> src/providers/proxy/proxy.h:33:#include <sys/types.h> src/responder/sudo/sudosrv_private.h:26:#include <sys/types.h> src/sss_client/sudo/sss_sudo.h:33:#include <sys/types.h> src/util/child_common.h:29:#include <sys/types.h> src/util/find_uid.h:28:#include <sys/types.h> src/util/sss_ldap.h:24:#include <sys/types.h> src/util/sss_nss.h:25:#include <sys/types.h> src/util/util.h:38:#include <sys/types.h> ^^^^^^^ The most important header file :-)
LS