From 2c06cc8e406f5c6d7d56121ebbaa271fc99706e8 Mon Sep 17 00:00:00 2001 From: Stephan Wiesand Date: Tue, 11 Apr 2017 11:58:55 +0200 Subject: [PATCH] Linux: only include cred.h if it exists Commit c89fd17df1032ec2eacc0d0c9b73e19c5e8db7d2 introduced an explicit include of linux/cred.h since the latest kernel no longer includes it implicitly in sched.h. Alas, older kernels (like 2.6.18) don't have this file. Add a configure test for the existence of cred.h and only include it if actually present. Reviewed-on: https://gerrit.openafs.org/12593 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 6b7b4239ab22fbb301e3b50e2ca4072445ba4e9e) Change-Id: I64970ba471180d32fa5af5445e7604bbe8511b32 Reviewed-on: https://gerrit.openafs.org/12598 Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- acinclude.m4 | 1 + src/afs/LINUX/osi_machdep.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 937fb5661b..464f356cb7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -868,6 +868,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) unsigned int flags]) dnl Check for header files + AC_CHECK_LINUX_HEADER([cred.h]) AC_CHECK_LINUX_HEADER([config.h]) AC_CHECK_LINUX_HEADER([completion.h]) AC_CHECK_LINUX_HEADER([exportfs.h]) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 9d3faa9035..9008f7732e 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -71,8 +71,10 @@ #define afs_hz HZ #include "h/sched.h" -/* in case cred.h is not included in sched.h */ +/* in case cred.h is present but not included in sched.h */ +#if defined(HAVE_LINUX_CRED_H) #include "h/cred.h" +#endif #if defined(HAVE_LINUX_CURRENT_KERNEL_TIME) static inline time_t osi_Time(void) { struct timespec xtime;