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 @@ -2800,6 +2800,15 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
2800
2800
sec->writeHeaderTo <ELFT>(++sHdrs );
2801
2801
}
2802
2802
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
+
2803
2812
// Open a result file.
2804
2813
template <class ELFT > void Writer<ELFT>::openFile() {
2805
2814
uint64_t maxSize = config->is64 ? INT64_MAX : UINT32_MAX;
@@ -2825,7 +2834,7 @@ template <class ELFT> void Writer<ELFT>::openFile() {
2825
2834
// In case there's no space left on the device
2826
2835
// it will error with SIGBUS, which is confusing
2827
2836
// 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 ));
2829
2838
if (!ErrOrSpaceInfo)
2830
2839
error (" Can't get remaining size on disk" );
2831
2840
if (ErrOrSpaceInfo.get ().free < fileSize)
You can’t perform that action at this time.
0 commit comments