File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2800,6 +2800,15 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
28002800 sec->writeHeaderTo <ELFT>(++sHdrs );
28012801}
28022802
2803+ static StringRef parentPathOrDot (StringRef path) {
2804+ auto parent_path = sys::path::parent_path (path);
2805+ if (parent_path.empty () && !path.empty () && !sys::path::is_absolute (path)) {
2806+ return " ." ;
2807+ } else {
2808+ return parent_path;
2809+ }
2810+ }
2811+
28032812// Open a result file.
28042813template <class ELFT > void Writer<ELFT>::openFile() {
28052814 uint64_t maxSize = config->is64 ? INT64_MAX : UINT32_MAX;
@@ -2825,7 +2834,7 @@ template <class ELFT> void Writer<ELFT>::openFile() {
28252834 // In case there's no space left on the device
28262835 // it will error with SIGBUS, which is confusing
28272836 // for users
2828- auto ErrOrSpaceInfo = sys::fs::disk_space (sys::path::parent_path (config->outputFile ));
2837+ auto ErrOrSpaceInfo = sys::fs::disk_space (parentPathOrDot (config->outputFile ));
28292838 if (!ErrOrSpaceInfo)
28302839 error (" Can't get remaining size on disk" );
28312840 if (ErrOrSpaceInfo.get ().free < fileSize)
You can’t perform that action at this time.
0 commit comments