X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=support%2Fgrp.c;h=827bc550d938fa91252db4ca620d739b939cb508;hb=30cddad5fb4c3d290906a6e6c33ecd8b07d8b48c;hp=47749b2131cababc8c5411136dc13107dc43ce95;hpb=b2262f41726a89c8209facb3ea9e4be9582422b5;p=mono.git diff --git a/support/grp.c b/support/grp.c index 47749b2131c..827bc550d93 100644 --- a/support/grp.c +++ b/support/grp.c @@ -8,7 +8,9 @@ */ #include +#ifdef HAVE_SYS_PARAM_H #include +#endif #include #include #include @@ -226,6 +228,7 @@ Mono_Posix_Syscall_getgrgid_r (mph_gid_t gid, } #endif /* ndef HAVE_GETGRGID_R */ +#if HAVE_GETGRENT gint32 Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf) { @@ -247,6 +250,7 @@ Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf) } return 0; } +#endif /* def HAVE_GETGRENT */ #ifdef HAVE_FGETGRENT gint32 @@ -272,28 +276,36 @@ Mono_Posix_Syscall_fgetgrent (void *stream, struct Mono_Posix_Syscall__Group *gr } #endif /* ndef HAVE_FGETGRENT */ +#if HAVE_SETGROUPS gint32 Mono_Posix_Syscall_setgroups (mph_size_t size, mph_gid_t *list) { mph_return_if_size_t_overflow (size); return setgroups ((size_t) size, list); } +#endif /* def HAVE_SETGROUPS */ +#if HAVE_SETGRENT int Mono_Posix_Syscall_setgrent (void) { errno = 0; - setgrent (); - return errno == 0 ? 0 : -1; + do { + setgrent (); + } while (errno == EINTR); + mph_return_if_val_in_list5(errno, EIO, EMFILE, ENFILE, ENOMEM, ERANGE); + return 0; } +#endif /* def HAVE_SETGRENT */ +#if HAVE_ENDGRENT int Mono_Posix_Syscall_endgrent (void) { - errno = 0; endgrent(); - return errno == 0 ? 0 : -1; + return 0; } +#endif /* def HAVE_ENDGRENT */ G_END_DECLS