diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-17 10:56:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-05-17 10:56:36 +0200 |
commit | c1e9c118b890ff59c2971ce12753a655bedcf1c2 (patch) | |
tree | dc1b017eb959a36182734f63339d54d9119cdb85 | |
parent | d8c333ecf179b652eaabf71a512aebc1864f6bf7 (diff) |
Handle attempt to open directory as file on OpenBSD
-rw-r--r-- | libbutl/fdstream.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx index fb2c8d1..03c007c 100644 --- a/libbutl/fdstream.cxx +++ b/libbutl/fdstream.cxx @@ -1025,10 +1025,11 @@ namespace butl #endif // Unlike other platforms, *BSD allows opening a directory as a file which - // will cause all kinds of problems upstream (e.g., cpfile()). So we detect - // and diagnose this. + // will cause all kinds of problems upstream (e.g., cpfile()). So we + // detect and diagnose this. Note: not certain this is the case for NetBSD + // and OpenBSD. // -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) { struct stat s; if (stat (f, &s) == 0 && S_ISDIR (s.st_mode)) |