Description:
There is a bug in the configure script for mysql 3.23.57. One of the configure tests
involves compiling and running the following file. It comes from acinclude.m4 around
line 613, under the test MYSQL_CHECK_LONGLONG_TO_FLOAT.
#include <stdio.h>
typedef long long longlong;
main()
{
longlong ll=1;
float f;
FILE *file=fopen("conftestval", "w");
f = (float) ll;
fprintf(file,"%g\n",f);
close(file);
exit (0);
}
Obviously the `close' on the third-to-last line should be an `fclose'.
On most systems the bogus close will fail with EBADF, which will be ignored, and there is
no real problem. However, under FreeBSD 5.1, due to a quirk in the reentrant libc, this
actually causes a segfault, and as a result `configure' fails and mysql cannot be built.
This libc behavior is arguably incorrect, but nevertheless the `close' call is certainly
incorrect and IMHO should be fixed.
Also, it might be a good idea to check the return value from `fopen', so as not to
segfault if for some reason the file cannot be opened.
I'm calling this "serious" because it keeps you from building mysql on this platform, but
please alter the severity if it's not appropriate.
How to repeat:
./configure
Suggested fix:
Change close to fclose
Check return value from fopen
Description: There is a bug in the configure script for mysql 3.23.57. One of the configure tests involves compiling and running the following file. It comes from acinclude.m4 around line 613, under the test MYSQL_CHECK_LONGLONG_TO_FLOAT. #include <stdio.h> typedef long long longlong; main() { longlong ll=1; float f; FILE *file=fopen("conftestval", "w"); f = (float) ll; fprintf(file,"%g\n",f); close(file); exit (0); } Obviously the `close' on the third-to-last line should be an `fclose'. On most systems the bogus close will fail with EBADF, which will be ignored, and there is no real problem. However, under FreeBSD 5.1, due to a quirk in the reentrant libc, this actually causes a segfault, and as a result `configure' fails and mysql cannot be built. This libc behavior is arguably incorrect, but nevertheless the `close' call is certainly incorrect and IMHO should be fixed. Also, it might be a good idea to check the return value from `fopen', so as not to segfault if for some reason the file cannot be opened. I'm calling this "serious" because it keeps you from building mysql on this platform, but please alter the severity if it's not appropriate. How to repeat: ./configure Suggested fix: Change close to fclose Check return value from fopen