From 46636014c00cfc9b6bae227b11e4f8fca5b168b1 Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Fri, 18 May 2007 13:56:43 +0200 Subject: [PATCH] - Forgotten tempfile code. --- src/tempfile.c | 39 +++++++++++++++++++++++++++++++++++++++ src/tempfile.h | 8 ++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/tempfile.c create mode 100644 src/tempfile.h diff --git a/src/tempfile.c b/src/tempfile.c new file mode 100644 index 0000000..ec9c02e --- /dev/null +++ b/src/tempfile.c @@ -0,0 +1,39 @@ +/** + * + * @file tempfile.c + * + * Generate a temporary file stream + * + * Before Vista this was trivial, more or less. However Vista restricts access + * so much that this call usually breaks, which is a pretty annoying bug. + */ + +#include +#include + +#ifdef FORWINDOWS +#define WIN32_LEAN_AND_MEAN +#include +#endif + +#include "bool.h" +#include "symbol.h" + +//! Create a new temporary file and return the pointer. +/** + * Before Vista this was trivial, more or less. However Vista restricts access + * so much that this call usually breaks, which is a pretty annoying bug. + * + * http://msdn2.microsoft.com/en-us/library/aa363875.aspx + */ +FILE * +scyther_tempfile (void) +{ +#ifdef FORWINDOWS + /* For now, just the broken copy, I'm sorry. */ + return tmpfile (); +#else + /* On any other platform the normal stuff just works (tm) */ + return tmpfile (); +#endif +} diff --git a/src/tempfile.h b/src/tempfile.h new file mode 100644 index 0000000..14b2e39 --- /dev/null +++ b/src/tempfile.h @@ -0,0 +1,8 @@ +#ifndef TEMPFILES +#define TEMPFILES + +#include + +FILE *scyther_tempfile (void); + +#endif