commit a36a3eb159d88507705253577814a8fdcb2a86d1 parent 329aee76f71ca3fdc832e14e1b4ef7309e97e638 Author: Laurent Bercot <ska-skaware@skarnet.org> Date: Wed, 15 Mar 2017 09:32:36 +0000 sysdeps tests cleanup. (I expect BSDs to break, as usual.) Diffstat:
30 files changed, 24 insertions(+), 77 deletions(-)
diff --git a/src/sysdeps/tryaccept4.c b/src/sysdeps/tryaccept4.c @@ -11,8 +11,6 @@ #define _GNU_SOURCE #endif -#include <sys/types.h> - #include <sys/socket.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/src/sysdeps/tryancilautoclose.c b/src/sysdeps/tryancilautoclose.c @@ -11,7 +11,6 @@ #define _XPG4_2 #endif -#include <sys/types.h> #include <string.h> #include <unistd.h> #include <errno.h> diff --git a/src/sysdeps/tryclockmon.c b/src/sysdeps/tryclockmon.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/types.h> #include <time.h> int main (void) diff --git a/src/sysdeps/tryclockrt.c b/src/sysdeps/tryclockrt.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/types.h> #include <time.h> int main (void) diff --git a/src/sysdeps/trycmsgcloexec.c b/src/sysdeps/trycmsgcloexec.c @@ -15,7 +15,6 @@ # define _GNU_SOURCE #endif -#include <sys/types.h> #include <sys/socket.h> int main (void) diff --git a/src/sysdeps/trydevurandom.c b/src/sysdeps/trydevurandom.c @@ -1,22 +1,11 @@ /* ISC license. */ +#include <string.h> #include <unistd.h> -#include <sys/types.h> #include <fcntl.h> +#include <sys/stat.h> -static int byte_diff (char *s, unsigned int n, char *t) -{ - for (;;) - { - if (!n) return 0 ; - if (*s != *t) break ; - ++s ; ++t ; --n ; - } - return ((int)(unsigned int)(unsigned char) *s) - - ((int)(unsigned int)(unsigned char) *t); -} - -int main () +int main (void) { char a[64] ; char b[64] ; @@ -27,5 +16,5 @@ int main () fd = open("/dev/urandom", O_RDONLY) ; if ((fd == -1) || (read(fd, b, 64) < 64) ) return 111 ; close(fd) ; - return (!byte_diff(a, 64, b)) ; + return (!memcmp(a, 64, b)) ; } diff --git a/src/sysdeps/tryeproto.c b/src/sysdeps/tryeproto.c @@ -1,7 +1,9 @@ /* ISC license. */ #include <errno.h> + static int dummy ; + #ifndef EPROTO syntax error ! #endif diff --git a/src/sysdeps/tryflock.c b/src/sysdeps/tryflock.c @@ -3,7 +3,6 @@ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE -#include <sys/types.h> #include <sys/file.h> #include <fcntl.h> diff --git a/src/sysdeps/tryfutimens.c b/src/sysdeps/tryfutimens.c @@ -6,9 +6,7 @@ #define __EXTENSIONS__ #endif -#include <sys/types.h> #include <sys/stat.h> -#include <time.h> int main (void) { diff --git a/src/sysdeps/tryfutimes.c b/src/sysdeps/tryfutimes.c @@ -6,7 +6,6 @@ #define _BSD_SOURCE #endif -#include <sys/types.h> #include <sys/time.h> int main (void) diff --git a/src/sysdeps/trygetpeereid.c b/src/sysdeps/trygetpeereid.c @@ -3,7 +3,6 @@ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE -#include <sys/types.h> #include <unistd.h> int main (void) diff --git a/src/sysdeps/tryipv6.c b/src/sysdeps/tryipv6.c @@ -6,7 +6,6 @@ #define _XPG4_2 #define _XPG6 -#include <sys/types.h> #include <errno.h> #include <string.h> #include <sys/socket.h> diff --git a/src/sysdeps/trylsock.c b/src/sysdeps/trylsock.c @@ -11,7 +11,6 @@ #define _GNU_SOURCE #endif -#include <sys/types.h> #include <sys/socket.h> int main (void) diff --git a/src/sysdeps/trymalloc0.c b/src/sysdeps/trymalloc0.c @@ -1,4 +1,8 @@ /* ISC license */ #include <stdlib.h> -int main() { return !malloc(0) ; } + +int main (void) +{ + return !malloc(0) ; +} diff --git a/src/sysdeps/trymsgdontwait.c b/src/sysdeps/trymsgdontwait.c @@ -11,7 +11,6 @@ #define _BSD_SOURCE #endif -#include <sys/types.h> #include <sys/socket.h> int value = MSG_DONTWAIT ; diff --git a/src/sysdeps/trynbwaitall.c b/src/sysdeps/trynbwaitall.c @@ -14,7 +14,6 @@ #define _GNU_SOURCE #endif -#include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> diff --git a/src/sysdeps/tryposixspawn.c b/src/sysdeps/tryposixspawn.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/types.h> #include <spawn.h> int main (void) diff --git a/src/sysdeps/tryrevoke.c b/src/sysdeps/tryrevoke.c @@ -4,4 +4,8 @@ #undef _XOPEN_SOURCE #include <unistd.h> -int main () { return revoke("/") ; } + +int main (void) +{ + return revoke("/") ; +} diff --git a/src/sysdeps/trysendfile.c b/src/sysdeps/trysendfile.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/types.h> #include <sys/sendfile.h> int main (void) diff --git a/src/sysdeps/trysetgroups.c b/src/sysdeps/trysetgroups.c @@ -15,7 +15,6 @@ #define __EXTENSIONS__ #endif -#include <sys/types.h> #include <unistd.h> #include <grp.h> diff --git a/src/sysdeps/trysettimeofday.c b/src/sysdeps/trysettimeofday.c @@ -15,7 +15,6 @@ #define __EXTENSIONS__ #endif -#include <sys/types.h> #include <sys/time.h> int main (void) diff --git a/src/sysdeps/trysignalfd.c b/src/sysdeps/trysignalfd.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/types.h> #include <signal.h> #include <sys/signalfd.h> diff --git a/src/sysdeps/trysizeofgid.c b/src/sysdeps/trysizeofgid.c @@ -1,8 +0,0 @@ -#include <sys/types.h> -#include <stdio.h> - -int main (void) -{ - printf("%u\n", (unsigned int)sizeof(gid_t)) ; - return 0 ; -} diff --git a/src/sysdeps/trysizeoftime.c b/src/sysdeps/trysizeoftime.c @@ -1,8 +0,0 @@ -#include <sys/types.h> -#include <stdio.h> - -int main (void) -{ - printf("%u\n", (unsigned int)sizeof(time_t)) ; - return 0 ; -} diff --git a/src/sysdeps/trysizeofuint.c b/src/sysdeps/trysizeofuint.c @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main (void) -{ - printf("%u\n", (unsigned int)sizeof(unsigned int)) ; - return 0 ; -} diff --git a/src/sysdeps/trysizeofulong.c b/src/sysdeps/trysizeofulong.c @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main (void) -{ - printf("%u\n", (unsigned int)sizeof(unsigned long)) ; - return 0 ; -} diff --git a/src/sysdeps/trysizeofushort.c b/src/sysdeps/trysizeofushort.c @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main (void) -{ - printf("%u\n", (unsigned int)sizeof(unsigned short)) ; - return 0 ; -} diff --git a/src/sysdeps/trysopeercred.c b/src/sysdeps/trysopeercred.c @@ -11,7 +11,6 @@ #define _GNU_SOURCE #endif -#include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> diff --git a/src/sysdeps/trysplice.c b/src/sysdeps/trysplice.c @@ -1,7 +1,9 @@ /* ISC license. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE -#include <sys/types.h> +#endif + #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> diff --git a/src/sysdeps/trystrnlen.c b/src/sysdeps/trystrnlen.c @@ -1,4 +1,8 @@ /* ISC license. */ #include <string.h> -int main () { return strnlen("/", 1) ; } + +int main (void) +{ + return strnlen("/", 1) ; +}