https://bugs.winehq.org/show_bug.cgi?id=51846 --- Comment #2 from Ted Lyngmo <ted(a)lyncon.se> --- Comment on attachment 70740 --> https://bugs.winehq.org/attachment.cgi?id=70740 open_excl.cpp #define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <iostream> #include <memory> #include <stdexcept> #include <string> static const char* const testfile = "fileexcl.tst"; static void ok(bool status, const std::string& msg) { if(!status) throw std::runtime_error(msg); } struct closer { void operator()(std::FILE* fp) const { std::fclose(fp); } }; using File = std::unique_ptr<std::FILE, closer>; static void test_fopen_exclusive() { for(auto mode : {"wx", "w+x"}) { { // this should create the file File fp(std::fopen(testfile, mode)); ok(bool(fp), "failed creating file with mode " + std::string(mode)); } { // this should fail to overwrite the file File fp(std::fopen(testfile, mode)); ok(!fp, "overwrote existing file with mode " + std::string(mode)); } std::remove(testfile); } } int main() { try { test_fopen_exclusive(); std::cout << "All's well\n"; } catch(const std::runtime_error& ex) { std::cout << ex.what() << '\n'; std::remove(testfile); } } -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.