diff --git a/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp b/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp new file mode 100644 index 0000000..b885be4 --- /dev/null +++ b/test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp @@ -0,0 +1,34 @@ +// Test program to demonstrate that Linux does not support AT_SYMLINK_NOFOLLOW + +// Copyright Duncan Exon Smith 2012 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Test this by running: +// +// rm -rf data && mkdir data && g++ -otest-fchmodat test-fchmodat.cpp && (cd data && ../test-fchmodat) +// +// If no assertions go off, then it looks like fchmodat is supported, +// but AT_SYMLINK_NOFOLLOW is not supported. + +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + { std::ofstream file("out"); file << "contents"; } + + assert(!::symlink("out", "sym")); + + assert(!::fchmodat(AT_FDCWD, "out", S_IRUSR | S_IWUSR | S_IXUSR, 0)); + assert(!::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, 0)); + + assert(::fchmodat(AT_FDCWD, "sym", S_IRUSR | S_IWUSR | S_IXUSR, AT_SYMLINK_NOFOLLOW) == -1); + assert(errno == ENOTSUP); + + return 0; +} diff --git a/test/issues/readme.txt b/test/issues/readme.txt new file mode 100644 index 0000000..cf8198e --- /dev/null +++ b/test/issues/readme.txt @@ -0,0 +1,9 @@ +This directory contains tests related to specific issues. + +The names are intended to indicate both the function or condition being tested +and the issue number. + +----- +Copyright Beman Dawes 2012 +Distributed under the Boost Software License, Version 1.0. +See http://www.boost.org/LICENSE_1_0.txt