diff options
Diffstat (limited to 'libs/pbd/sndfile_manager.cc')
-rw-r--r-- | libs/pbd/sndfile_manager.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/pbd/sndfile_manager.cc b/libs/pbd/sndfile_manager.cc index d1dcd05256..c3fbd7be5b 100644 --- a/libs/pbd/sndfile_manager.cc +++ b/libs/pbd/sndfile_manager.cc @@ -90,7 +90,16 @@ SndFileDescriptor::open () { /* we must have a lock on the FileManager's mutex */ - _sndfile = sf_open (_path.c_str(), _writeable ? SFM_RDWR : SFM_READ, _info); + int fd = ::open(_path.c_str(), O_LARGEFILE | (_writeable ? (O_RDWR|O_CREAT) : O_RDONLY)); + if (fd == -1) return false; + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + + _sndfile = sf_open_fd (fd, _writeable ? SFM_RDWR : SFM_READ, _info, 1); + + if (sf_open_fd == 0) { + ::close(fd); + } + return (_sndfile == 0); } |