Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
calendulish committed Jan 10, 2023
1 parent 43562b8 commit 293894e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/steamworks/steamworks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
/ along with this program. If not, see http://www.gnu.org/licenses/.
*/

#include <stdio.h>

#ifdef _WIN32
#include <io.h>
#define BLACK_HOLE "nul"
#define fileno _fileno
#define dup _dup
#define dup2 _dup2
#else
#include <unistd.h>
#define BLACK_HOLE "/dev/null"
#endif

Expand All @@ -36,14 +43,14 @@ class BlackHole {
: old_descriptor (-1)
{
fflush(stderr);
old_descriptor = _dup(_fileno(stderr));
old_descriptor = dup(fileno(stderr));
freopen(hole, "wb", stderr);
}

~BlackHole ()
{
fflush(stderr);
_dup2(old_descriptor, _fileno(stderr));
dup2(old_descriptor, fileno(stderr));
}
};

Expand Down

0 comments on commit 293894e

Please sign in to comment.