MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / OpenTempFile

Function OpenTempFile

src/io/FileOutputStream.cxx:173–185  ·  view source on GitHub ↗

* Open a file using Linux's O_TMPFILE for writing the given file. */

Source from the content-addressed store, hash-verified

171 * Open a file using Linux's O_TMPFILE for writing the given file.
172 */
173static bool
174OpenTempFile(FileDescriptor directory_fd,
175 FileDescriptor &fd, Path path) noexcept
176{
177 if (directory_fd != FileDescriptor(AT_FDCWD))
178 return fd.Open(directory_fd, ".", O_TMPFILE|O_WRONLY, 0666);
179
180 const auto directory = path.GetDirectoryName();
181 if (directory.IsNull())
182 return false;
183
184 return fd.Open(directory.c_str(), O_TMPFILE|O_WRONLY, 0666);
185}
186
187#endif /* HAVE_O_TMPFILE */
188

Callers 1

Calls 2

GetDirectoryNameMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected