File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,16 @@ OpenDirectory(FileAt file, int flags)
101101 return fd;
102102}
103103
104+ UniqueFileDescriptor
105+ OpenDirectoryPath (FileAt file, int flags)
106+ {
107+ UniqueFileDescriptor fd;
108+ if (!fd.Open (file, O_PATH|O_DIRECTORY|flags))
109+ throw FmtErrno (" Failed to open {:?}" , file.name );
110+
111+ return fd;
112+ }
113+
104114#ifdef HAVE_OPENAT2
105115
106116UniqueFileDescriptor
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ OpenWriteOnly(FileAt file, int flags=0);
3737UniqueFileDescriptor
3838OpenDirectory (FileAt file, int flags=0 );
3939
40+ /* *
41+ * Combination of OpenDirectory() and OpenPath() - open a directory as
42+ * an O_PATH file descriptor. Like OpenDirectory(), it will fail with
43+ * ENOTDIR if the specified path exists but is not a directory
44+ */
45+ UniqueFileDescriptor
46+ OpenDirectoryPath (FileAt file, int flags=0 );
47+
4048struct opwn_how ;
4149
4250/* *
You can’t perform that action at this time.
0 commit comments