summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.vnet.ibm.com>2017-11-07 11:22:08 +1100
committerSergey Vojtovich <svoj@mariadb.org>2017-11-15 11:37:32 +0800
commit3948f4b4dc8126616396dcf797ce0213597fe0b8 (patch)
tree112d139211179f101d653e4c6b96cdffbab3d727 /mysys
parent761e6574c879998817d932198906545815987091 (diff)
downloadmariadb-git-3948f4b4dc8126616396dcf797ce0213597fe0b8.tar.gz
mysys: Remove freebsd freopen implementation
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=79887 was fixed in 7.4 and 8.2. Both of these reached end of life in February 2011 https://www.freebsd.org/releases/ Signed-off-by: Daniel Black <daniel@linux.vnet.ibm.com>
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_fopen.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 7dde1e1b4fc..9318e6ed76e 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -19,10 +19,6 @@
#include <errno.h>
#include "mysys_err.h"
-#if defined(__FreeBSD__)
-extern int getosreldate(void);
-#endif
-
static void make_ftype(char * to,int flag);
/*
@@ -130,52 +126,6 @@ static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream)
return stream;
}
-#elif defined(__FreeBSD__)
-
-/* No close operation hook. */
-
-static int no_close(void *cookie __attribute__((unused)))
-{
- return 0;
-}
-
-/*
- A hack around a race condition in the implementation of freopen.
-
- The race condition stems from the fact that the current fd of
- the stream is closed before its number is used to duplicate the
- new file descriptor. This defeats the desired atomicity of the
- close and duplicate of dup2().
-
- See PR number 79887 for reference:
- http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
-*/
-
-static FILE *my_freebsd_freopen(const char *path, const char *mode, FILE *stream)
-{
- int old_fd;
- FILE *result;
-
- flockfile(stream);
-
- old_fd= fileno(stream);
-
- /* Use a no operation close hook to avoid having the fd closed. */
- stream->_close= no_close;
-
- /* Relies on the implicit dup2 to close old_fd. */
- result= freopen(path, mode, stream);
-
- /* If successful, the _close hook was replaced. */
-
- if (result == NULL)
- close(old_fd);
- else
- funlockfile(result);
-
- return result;
-}
-
#endif
@@ -199,16 +149,6 @@ FILE *my_freopen(const char *path, const char *mode, FILE *stream)
#if defined(_WIN32)
result= my_win_freopen(path, mode, stream);
-#elif defined(__FreeBSD__)
- /*
- XXX: Once the fix is ported to the stable releases, this should
- be dependent upon the specific FreeBSD versions. Check at:
- http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
- */
- if (getosreldate() > 900027)
- result= freopen(path, mode, stream);
- else
- result= my_freebsd_freopen(path, mode, stream);
#else
result= freopen(path, mode, stream);
#endif