git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7] autoconf: Test FREAD_READS_DIRECTORIES
@ 2008-03-11  8:48 Michal Rokos
  2008-03-11 20:46 ` Mitch Tishmack
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Rokos @ 2008-03-11  8:48 UTC (permalink / raw)
  To: GIT

Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed 
directory.

Tested on:
AIX 5.3 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
HP-UX B.11.11 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
HP-UX B.11.23 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
Linux 2.6.25-rc4 - FREAD_READS_DIRECTORIES=
Tru64 V5.1 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
Windows - FREAD_READS_DIRECTORIES=

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

diff --git a/config.mak.in b/config.mak.in
index 8e1cd5f..7868dfd 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -46,4 +46,5 @@ NO_MKDTEMP=@NO_MKDTEMP@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
diff --git a/configure.ac b/configure.ac
index 287149d..82584e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,26 @@ else
 fi
 AC_SUBST(NO_C99_FORMAT)
 #
+# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
+# when attempting to read from an fopen'ed directory.
+AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
+ [ac_cv_fread_reads_directories],
+[
+AC_RUN_IFELSE(
+	[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+		[[char c;
+		FILE *f = fopen(".", "r");
+		return f && fread(&c, 1, 1, f)]])],
+	[ac_cv_fread_reads_directories=no],
+	[ac_cv_fread_reads_directories=yes])
+])
+if test $ac_cv_fread_reads_directories = yes; then
+	FREAD_READS_DIRECTORIES=UnfortunatelyYes
+else
+	FREAD_READS_DIRECTORIES=
+fi
+AC_SUBST(FREAD_READS_DIRECTORIES)
+#
 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
 # or vsnprintf() return -1 instead of number of characters which would
 # have been written to the final string if enough space had been available.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v7] autoconf: Test FREAD_READS_DIRECTORIES
  2008-03-11  8:48 [PATCH v7] autoconf: Test FREAD_READS_DIRECTORIES Michal Rokos
@ 2008-03-11 20:46 ` Mitch Tishmack
  0 siblings, 0 replies; 2+ messages in thread
From: Mitch Tishmack @ 2008-03-11 20:46 UTC (permalink / raw)
  To: Michal Rokos; +Cc: GIT

Can add these systems.

OS X 10.5 x86 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
Tested-by: Mitch Tishmack <mitch.tishmack@gmail.com>

Solaris 10 Update 4 (08/07) x86 - FREAD_READS_DIRECTORIES=
Tested-by: Mitch Tishmack <mitch.tishmack@gmail.com>

mitch

On Mar 11, 2008, at 03:48 AM, Michal Rokos wrote:

> Add test for FREAD_READS_DIRECTORIES to detect when fread() reads  
> fopen'ed
> directory.
>
> Tested on:
> AIX 5.3 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
> HP-UX B.11.11 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
> HP-UX B.11.23 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
> Linux 2.6.25-rc4 - FREAD_READS_DIRECTORIES=
> Tru64 V5.1 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
> Windows - FREAD_READS_DIRECTORIES=
>
> Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
> Tested-by: Mike Ralphson <mike@abacus.co.uk>
> Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>
> diff --git a/config.mak.in b/config.mak.in
> index 8e1cd5f..7868dfd 100644
> --- a/config.mak.in
> +++ b/config.mak.in
> @@ -46,4 +46,5 @@ NO_MKDTEMP=@NO_MKDTEMP@
> NO_ICONV=@NO_ICONV@
> OLD_ICONV=@OLD_ICONV@
> NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
> +FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
> SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
> diff --git a/configure.ac b/configure.ac
> index 287149d..82584e9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -327,6 +327,26 @@ else
> fi
> AC_SUBST(NO_C99_FORMAT)
> #
> +# Define FREAD_READS_DIRECTORIES if your are on a system which  
> succeeds
> +# when attempting to read from an fopen'ed directory.
> +AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
> + [ac_cv_fread_reads_directories],
> +[
> +AC_RUN_IFELSE(
> +	[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
> +		[[char c;
> +		FILE *f = fopen(".", "r");
> +		return f && fread(&c, 1, 1, f)]])],
> +	[ac_cv_fread_reads_directories=no],
> +	[ac_cv_fread_reads_directories=yes])
> +])
> +if test $ac_cv_fread_reads_directories = yes; then
> +	FREAD_READS_DIRECTORIES=UnfortunatelyYes
> +else
> +	FREAD_READS_DIRECTORIES=
> +fi
> +AC_SUBST(FREAD_READS_DIRECTORIES)
> +#
> # Define SNPRINTF_RETURNS_BOGUS if your are on a system which  
> snprintf()
> # or vsnprintf() return -1 instead of number of characters which would
> # have been written to the final string if enough space had been  
> available.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-11 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11  8:48 [PATCH v7] autoconf: Test FREAD_READS_DIRECTORIES Michal Rokos
2008-03-11 20:46 ` Mitch Tishmack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).