mirror of
https://github.com/boostorg/filesystem.git
synced 2025-05-12 13:41:47 +00:00
Add a directory for issues related test programs.
[SVN r79467]
This commit is contained in:
parent
bb0fe7585c
commit
d5328e4d05
34
test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp
Normal file
34
test/issues/fchmodat_AT_SYMLINK_NOFOLLOW_6659.cpp
Normal file
@ -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 <fstream>
|
||||
#include <cassert>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <cerrno>
|
||||
|
||||
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;
|
||||
}
|
9
test/issues/readme.txt
Normal file
9
test/issues/readme.txt
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user