From 1885e59a34045f1cbdae34fbc1ba2e5e051a6b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Sun, 4 Feb 2024 00:15:37 -0500 Subject: [PATCH] Fix some NetBSD warnings --- src/xpdev/dirwrap.c | 4 ++-- src/xpdev/xpbeep.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c index b4261a5c1f..3a0708e1c1 100644 --- a/src/xpdev/dirwrap.c +++ b/src/xpdev/dirwrap.c @@ -950,8 +950,8 @@ static uint64_t getdiskspace(const char* path, uint64_t unit, bool freespace) struct statvfs fs; uint64_t blocks; - if (statvfs(path, &fs) < 0) - return 0; + if (statvfs(path, &fs) < 0) + return 0; if(freespace) blocks=fs.f_bavail; diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c index 7e703df46e..cfc813dd88 100644 --- a/src/xpdev/xpbeep.c +++ b/src/xpdev/xpbeep.c @@ -1183,8 +1183,6 @@ bool xptone(double freq, DWORD duration, enum WAVE_SHAPE shape) /****************************************************************************/ void unix_beep(int freq, int dur) { - static int console_fd=-1; - #if (defined(__FreeBSD__) && defined(HAS_MACHINE_SPEAKER_H)) || ((defined(__OpenBSD__) || defined(__NetBSD__)) && defined(HAS_MACHINE_SPKR_H)) int speaker_fd=-1; tone_t tone; @@ -1200,6 +1198,8 @@ void unix_beep(int freq, int dur) #endif #if !defined(__GNU__) && !defined(__QNX__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__HAIKU__) && !defined(__EMSCRIPTEN__) + static int console_fd=-1; + if(console_fd == -1) console_fd = open("/dev/console", O_NOCTTY); -- GitLab