Unfortunately std::ifstream and std::ofstream are allowed to fail in unobvious ways when given a duff file. In particular, gcc won't error out when a std::ifstream is created for a directory until the first read occurs. So we write our own stream buffer classes that do error checking and throw useful exceptions on error, and use those instead.
18 lines
339 B
Bash
Executable File
18 lines
339 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# vim: set ft=sh sw=4 sts=4 et :
|
|
|
|
mkdir safe_ifstream_TEST_dir || exit 2
|
|
cd safe_ifstream_TEST_dir || exit 3
|
|
|
|
echo first > existing
|
|
for (( a = 0 ; a < 1000 ; ++a )) ; do
|
|
echo -n x >> existing
|
|
done
|
|
echo >> existing
|
|
|
|
mkdir existing_dir
|
|
ln -s existing_sym_target existing
|
|
touch existing_perm
|
|
chmod a-rw existing_perm
|
|
|