@@ -321,27 +321,27 @@ struct scoped_test_env
321
321
// allow tests to call this unguarded.
322
322
#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(_WIN32)
323
323
std::string create_socket (std::string file) {
324
- file = sanitize_path (std::move ( file) );
324
+ std::string socket_file = sanitize_path (file);
325
325
326
326
::sockaddr_un address;
327
327
address.sun_family = AF_UNIX;
328
328
329
329
// If file.size() is too big, try to create a file directly inside
330
330
// /tmp to make sure file path is short enough.
331
- if (file .size () <= sizeof (address.sun_path ) && utils::exists (" /tmp" )) {
331
+ if (socket_file .size () <= sizeof (address.sun_path ) && utils::exists (" /tmp" )) {
332
332
fs::path const tmp = " /tmp" ;
333
333
std::size_t i = std::hash<std::string>()(std::to_string (std::time (nullptr )));
334
334
fs::path p = tmp / (" libcxx-socket-" + file + " -" + std::to_string (i));
335
335
while (utils::exists (p.string ())) {
336
336
p = tmp / (" libcxx-socket-" + file + " -" + std::to_string (++i));
337
337
}
338
- file = p.string ();
338
+ socket_file = p.string ();
339
339
}
340
- assert (file .size () <= sizeof (address.sun_path ));
341
- ::strncpy (address.sun_path, file .c_str(), sizeof(address.sun_path));
340
+ assert (socket_file .size () <= sizeof (address.sun_path ));
341
+ ::strncpy (address.sun_path, socket_file .c_str(), sizeof(address.sun_path));
342
342
int fd = ::socket (AF_UNIX, SOCK_STREAM, 0 );
343
343
assert (::bind (fd, reinterpret_cast <::sockaddr*>(&address), sizeof (address)) == 0 );
344
- return file ;
344
+ return socket_file ;
345
345
}
346
346
#endif
347
347
0 commit comments