Skip to content

Commit ec6ff97

Browse files
committed
fix error
1 parent 5d64d75 commit ec6ff97

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcxx/test/support/filesystem_test_helper.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,27 +321,27 @@ struct scoped_test_env
321321
// allow tests to call this unguarded.
322322
#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(_WIN32)
323323
std::string create_socket(std::string file) {
324-
file = sanitize_path(std::move(file));
324+
std::string socket_file = sanitize_path(file);
325325

326326
::sockaddr_un address;
327327
address.sun_family = AF_UNIX;
328328

329329
// If file.size() is too big, try to create a file directly inside
330330
// /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")) {
332332
fs::path const tmp = "/tmp";
333333
std::size_t i = std::hash<std::string>()(std::to_string(std::time(nullptr)));
334334
fs::path p = tmp / ("libcxx-socket-" + file + "-" + std::to_string(i));
335335
while (utils::exists(p.string())) {
336336
p = tmp / ("libcxx-socket-" + file + "-" + std::to_string(++i));
337337
}
338-
file = p.string();
338+
socket_file = p.string();
339339
}
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));
342342
int fd = ::socket(AF_UNIX, SOCK_STREAM, 0);
343343
assert(::bind(fd, reinterpret_cast<::sockaddr*>(&address), sizeof(address)) == 0);
344-
return file;
344+
return socket_file;
345345
}
346346
#endif
347347

0 commit comments

Comments
 (0)