File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2744,6 +2744,15 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
2744
2744
sec->writeHeaderTo <ELFT>(++sHdrs );
2745
2745
}
2746
2746
2747
+ static StringRef parentPathOrDot (StringRef path) {
2748
+ auto parent_path = sys::path::parent_path (path);
2749
+ if (parent_path.empty () && !path.empty () && !sys::path::is_absolute (path)) {
2750
+ return " ." ;
2751
+ } else {
2752
+ return parent_path;
2753
+ }
2754
+ }
2755
+
2747
2756
// Open a result file.
2748
2757
template <class ELFT > void Writer<ELFT>::openFile() {
2749
2758
uint64_t maxSize = config->is64 ? INT64_MAX : UINT32_MAX;
@@ -2769,7 +2778,7 @@ template <class ELFT> void Writer<ELFT>::openFile() {
2769
2778
// In case there's no space left on the device
2770
2779
// it will error with SIGBUS, which is confusing
2771
2780
// for users
2772
- auto ErrOrSpaceInfo = sys::fs::disk_space (sys::path::parent_path (config->outputFile ));
2781
+ auto ErrOrSpaceInfo = sys::fs::disk_space (parentPathOrDot (config->outputFile ));
2773
2782
if (!ErrOrSpaceInfo)
2774
2783
error (" Can't get remaining size on disk" );
2775
2784
if (ErrOrSpaceInfo.get ().free < fileSize)
You can’t perform that action at this time.
0 commit comments