aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/solaris.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/solaris.cpp')
-rw-r--r--alc/backends/solaris.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp
index a5bb45b0..68ab814c 100644
--- a/alc/backends/solaris.cpp
+++ b/alc/backends/solaris.cpp
@@ -148,11 +148,15 @@ void SolarisBackend::open(const char *name)
throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found",
name};
- mFd = ::open(solaris_driver.c_str(), O_WRONLY);
- if(mFd == -1)
+ int fd{::open(solaris_driver.c_str(), O_WRONLY)};
+ if(fd == -1)
throw al::backend_exception{al::backend_error::NoDevice, "Could not open %s: %s",
solaris_driver.c_str(), strerror(errno)};
+ if(mFd != -1)
+ ::close(mFd);
+ mFd = fd;
+
mDevice->DeviceName = name;
}