Fix realpath() check so that it doesn't generate a core() when it fails.
[ira/wip.git] / source3 / configure.in
index fc66c17425c6a857d9b6dcfc14a951e4d0b5c144..2ae5e35295d604d02ac860fe7e1b71fcdf4d899f 100644 (file)
@@ -2795,9 +2795,17 @@ AC_CACHE_CHECK([if the realpath function allows a NULL argument],samba_cv_REALPA
 AC_TRY_RUN([
 #include <stdio.h>
 #include <limits.h>
+#include <signal.h>
+
+void exit_on_core(int ignored) {
+       exit(1);
+}
+
 main() {
-       char *newpath = realpath("/tmp", NULL);
-       exit ((newpath != NULL) ? 0 : 1);
+       char *newpath;
+       signal(SIGSEGV, exit_on_core);
+       newpath = realpath("/tmp", NULL);
+       exit((newpath != NULL) ? 0 : 1);
 }
 ],
 samba_cv_REALPATH_TAKES_NULL=yes,samba_cv_REALPATH_TAKES_NULL=no,samba_cv_REALPATH_TAKES_NULL=cross)])