aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar kimrhh <kimrhh@exherbo.org> 2008-06-22 19:43:12 +0200
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-22 21:41:00 +0100
commitf16b08069478b4029ca48f78d13aa6663a592148 (patch)
treec24dcafe7e6d5c400bab8c0fc216bdb4a8e93d06
parent653c7151c5a5049c38a3afe12d11d75f08c2537f (diff)
downloadpaludis-f16b08069478b4029ca48f78d13aa6663a592148.tar.gz
paludis-f16b08069478b4029ca48f78d13aa6663a592148.tar.xz
use fstat to check for directory - for portability
-rw-r--r--paludis/merger.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/paludis/merger.cc b/paludis/merger.cc
index 0713a27..920e880 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -952,10 +952,16 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
"rename failed. Falling back to recursive copy.";
dst.mkdir(mode);
- FDHolder dst_fd(::open(stringify(dst).c_str(), O_RDONLY | O_DIRECTORY));
+ FDHolder dst_fd(::open(stringify(dst).c_str(), O_RDONLY));
+ struct stat sb;
if (-1 == dst_fd)
throw MergerError("Could not get an FD for the directory '"
+ stringify(dst) + "' that we just created: " + stringify(::strerror(errno)));
+ if (-1 == ::fstat(dst_fd, &sb))
+ throw MergerError("Could not fstat the directory '"
+ + stringify(dst) + "' that we just created: " + stringify(::strerror(errno)));
+ if ( !S_ISDIR(sb.st_mode))
+ throw MergerError("The directory that we just created is not a directory anymore");
if (! _imp->params[k::no_chown()])
::fchown(dst_fd, src.owner(), src.group());
/* pick up set*id bits */