From c1e9c118b890ff59c2971ce12753a655bedcf1c2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 May 2022 10:56:36 +0200 Subject: Handle attempt to open directory as file on OpenBSD --- libbutl/fdstream.cxx | 7 ++++--- 1 file 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)) -- cgit v1.1