diff options
author | Robin Gareus <robin@gareus.org> | 2013-06-07 17:43:06 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2013-06-07 17:43:06 +0200 |
commit | 92161b57ad8eb65c5f3e265388c353d36ce20c8d (patch) | |
tree | 3411e7c7211b43d3f42fd11d862807c35270695e | |
parent | df99859ad2478700267a21f993eb421e555ae960 (diff) |
mark more filedes as close-on-exec. - here audio+midi files!
-rw-r--r-- | libs/pbd/file_manager.cc | 3 | ||||
-rw-r--r-- | libs/pbd/sndfile_manager.cc | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libs/pbd/file_manager.cc b/libs/pbd/file_manager.cc index a71ffca190..fb3227a922 100644 --- a/libs/pbd/file_manager.cc +++ b/libs/pbd/file_manager.cc @@ -289,6 +289,9 @@ StdioFileDescriptor::open () /* we must have a lock on the FileManager's mutex */ _file = fopen (_path.c_str(), _mode.c_str()); + if (_file) { + fcntl(fileno(_file), F_SETFD, fcntl(fileno(_file), F_GETFD) | FD_CLOEXEC); + } return (_file == 0); } diff --git a/libs/pbd/sndfile_manager.cc b/libs/pbd/sndfile_manager.cc index d1dcd05256..4977f21dfd 100644 --- a/libs/pbd/sndfile_manager.cc +++ b/libs/pbd/sndfile_manager.cc @@ -90,7 +90,12 @@ 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_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); + return (_sndfile == 0); } |