- char auth_file_name[] = "/tmp/Xvfb-auth-XXXXXX";
- auto_fd auth_file_fd(mkstemp(auth_file_name));
- if (auth_file_fd.get() == -1)
- throw std::runtime_error(std::strerror(errno));
- auto_temp_file auth_file(auth_file_name);
-
- // mkstemp may use lax permissions, so fix that before writing
- // the auth data to it.
- fchmod(auth_file_fd.get(), S_IREAD|S_IWRITE);
- ftruncate(auth_file_fd.get(), 0);