ObjFW  Diff

Differences From Artifact [63f2b5a434]:

  • File configure.ac — part of check-in [c615b62ed8] at 2024-04-16 23:50:40 on branch trunk — Don't use readdir_r

    readdir_r can easily lead to stack overflows if the path is longer than
    the space reserved for d_name in dirent. While some OSes use a length of
    MAXNAMLEN + 1, others use just 1. This could be worked around by always
    allocating a buffer of sizeof(struct dirent) + MAXNAMLEN (which would
    work only in case MAXNAMLEN is actually the longest readdir_r can
    return), but is probably not worth the risk, especially as glibc has
    entirely deprecated readdir_r and it is expected to be removed from
    POSIX. (user: js, size: 60786) [annotate] [blame] [check-ins using]

To Artifact [aab515e691]:


584
585
586
587
588
589
590
591
592

593
594
595


596
597

598
599
600
601
602
603
604


605
606
607
608
609


610
611
612
613
614
615







616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640





641
642
643
644
645
646
647
584
585
586
587
588
589
590


591



592
593


594



595



596
597





598
599






600
601
602
603
604
605
606








607
















608
609
610
611
612
613
614
615
616
617
618
619







-
-
+
-
-
-
+
+
-
-
+
-
-
-

-
-
-
+
+
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+







	])

	AS_IF([test x"$enable_seluid24" = x"yes"], [
		AC_DEFINE(OF_SELUID24, 1, [Whether to use 24 bit selector UIDs])
	])

	AC_MSG_CHECKING(for exception type)
	AC_COMPILE_IFELSE([
		AC_LANG_PROGRAM([
	AC_EGREP_CPP(egrep_cpp_yes, [
			extern void foo();
		], [
			@try {
		#ifdef __SEH__
		egrep_cpp_yes
				foo();
			} @finally {
		#endif
				foo();
			}
		])
	], [
		AS_IF([$SED 's/[[^[:print:]]]//g' <conftest.$ac_objext | \
		    $EGREP __gnu_objc_personality_v0 >/dev/null], [
			exception_type="DWARF"
		AC_MSG_RESULT(SEH)
		exception_type="SEH"
		])
		AS_IF([$SED 's/[[^[:print:]]]//g' <conftest.$ac_objext | \
		    $EGREP __gnu_objc_personality_sj0 >/dev/null], [
			exception_type="SjLj"
		])
		raise_exception="_Unwind_RaiseException"
	], [
		AS_IF([$SED 's/[[^[:print:]]]//g' <conftest.$ac_objext | \
		    $EGREP __gnu_objc_personality_seh0 >/dev/null], [
			exception_type="SEH"
		])

		case "$exception_type" in
		AC_EGREP_CPP(egrep_cpp_yes, [
			#ifdef __USING_SJLJ_EXCEPTIONS__
			egrep_cpp_yes
			#endif
		], [
			AC_MSG_RESULT(SjLj)
			exception_type="SjLj"
		DWARF)
			AC_DEFINE(HAVE_DWARF_EXCEPTIONS, 1,
				[Whether DWARF exceptions are used])
			raise_exception="_Unwind_RaiseException"
			;;
		SjLj)
			AC_DEFINE(HAVE_SJLJ_EXCEPTIONS, 1,
				[Whether SjLj exceptions are used])
			raise_exception="_Unwind_SjLj_RaiseException"
			;;
		SEH)
			AC_DEFINE(HAVE_SEH_EXCEPTIONS, 1,
				[Whether SEH exceptions are used])
			raise_exception="_Unwind_RaiseException"
			;;
		*)
			AC_MSG_RESULT(unknown)
			AC_MSG_ERROR([Exception type not detected!])
			;;
		esac

		AC_MSG_RESULT($exception_type)
	], [
		AC_MSG_RESULT(exceptions unavailable!)
		AC_MSG_ERROR([Exceptions not accepted by compiler!])
		], [
			AC_MSG_RESULT(DWARF)
			exception_type="DWARF"
			raise_exception="_Unwind_RaiseException"
		])
	])

	AC_SEARCH_LIBS($raise_exception, [c++abi gcc_s gcc unwind], [
		dnl c++abi requires pthread on OpenBSD
		AS_IF([test x"$ac_lib" = x"c++abi"], [LIBS="$LIBS -lpthread"])
	], [
		AC_MSG_ERROR([$raise_exception missing!])