[PATCH] D30912: Make FileOutputBuffer fail early if you pass a directory.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 15:31:11 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL297679: Make FileOutputBuffer fail early if you pass a directory. (authored by ruiu).

Changed prior to commit:
  https://reviews.llvm.org/D30912?vs=91625&id=91631#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30912

Files:
  lld/trunk/test/ELF/early-exit-for-bad-paths.s
  llvm/trunk/lib/Support/FileOutputBuffer.cpp


Index: lld/trunk/test/ELF/early-exit-for-bad-paths.s
===================================================================
--- lld/trunk/test/ELF/early-exit-for-bad-paths.s
+++ lld/trunk/test/ELF/early-exit-for-bad-paths.s
@@ -20,6 +20,9 @@
 # discovered we haven't bailed out early as expected.
 # CHECK-NOT: undefined_symbol
 
+# RUN: not ld.lld %t.o -o / 2>&1 | FileCheck %s -check-prefixes=ROOT
+# ROOT: error: cannot open output file /
+
   .globl _start
 _start:
   call undefined_symbol
Index: llvm/trunk/lib/Support/FileOutputBuffer.cpp
===================================================================
--- llvm/trunk/lib/Support/FileOutputBuffer.cpp
+++ llvm/trunk/lib/Support/FileOutputBuffer.cpp
@@ -57,6 +57,8 @@
         // FIXME: In posix, you use the access() call to check this.
       }
       break;
+    case sys::fs::file_type::directory_file:
+      return errc::is_a_directory;
     default:
       if (EC)
         return EC;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30912.91631.patch
Type: text/x-patch
Size: 949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170313/e450ac3d/attachment.bin>


More information about the llvm-commits mailing list