sapling/eden/fs/utils/NfsSocket.cpp
Xavier Deguillard a29d465ee8 fs: fix license header
Summary:
With Facebook having been renamed Meta Platforms, we need to change the license
headers.

Reviewed By: fanzeyi

Differential Revision: D33407812

fbshipit-source-id: b11bfbbf13a48873f0cea75f212cc7b07a68fb2e
2022-01-04 15:00:07 -08:00

26 lines
755 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include "eden/fs/utils/NfsSocket.h"
namespace facebook::eden {
folly::SocketAddress makeNfsSocket(std::optional<AbsolutePath> unixSocketPath) {
if (folly::kIsApple && unixSocketPath.has_value()) {
int rc = unlink(unixSocketPath->c_str());
if (rc != 0 && errno != ENOENT) {
folly::throwSystemError(
fmt::format("unable to remove socket file {}", *unixSocketPath));
}
return folly::SocketAddress::makeFromPath(unixSocketPath->stringPiece());
} else {
return folly::SocketAddress("127.0.0.1", 0);
}
}
} // namespace facebook::eden