pipe: use UV_PIPE_NO_TRUNCATE as needed
This commit is contained in:
parent
14cb806b1c
commit
7fda7c5072
@ -18,11 +18,11 @@ UVW_INLINE int pipe_handle::open(file_handle file) {
|
||||
return uv_pipe_open(raw(), file);
|
||||
}
|
||||
|
||||
UVW_INLINE int pipe_handle::bind(const std::string &name) {
|
||||
return uv_pipe_bind(raw(), name.data());
|
||||
UVW_INLINE int pipe_handle::bind(const std::string &name, const bool no_truncate) {
|
||||
return uv_pipe_bind2(raw(), name.data(), name.size(), no_truncate * UV_PIPE_NO_TRUNCATE);
|
||||
}
|
||||
|
||||
UVW_INLINE int pipe_handle::connect(const std::string &name) {
|
||||
UVW_INLINE int pipe_handle::connect(const std::string &name, const bool no_truncate) {
|
||||
auto listener = [ptr = shared_from_this()](const auto &event, const auto &) {
|
||||
ptr->publish(event);
|
||||
};
|
||||
@ -31,7 +31,7 @@ UVW_INLINE int pipe_handle::connect(const std::string &name) {
|
||||
connect->on<error_event>(listener);
|
||||
connect->on<connect_event>(listener);
|
||||
|
||||
return connect->connect(&uv_pipe_connect, raw(), name.data());
|
||||
return connect->connect(&uv_pipe_connect2, raw(), name.data(), name.size(), no_truncate * UV_PIPE_NO_TRUNCATE);
|
||||
}
|
||||
|
||||
UVW_INLINE std::string pipe_handle::sock() const noexcept {
|
||||
|
||||
@ -64,9 +64,10 @@ public:
|
||||
* Paths on Unix get truncated typically between 92 and 108 bytes.
|
||||
*
|
||||
* @param name A valid file path.
|
||||
* @param no_truncate Force an error rather than allow truncating a path.
|
||||
* @return Underlying return value.
|
||||
*/
|
||||
int bind(const std::string &name);
|
||||
int bind(const std::string &name, const bool no_truncate = false);
|
||||
|
||||
/**
|
||||
* @brief Connects to the Unix domain socket or the named pipe.
|
||||
@ -76,9 +77,10 @@ public:
|
||||
* established.
|
||||
*
|
||||
* @param name A valid domain socket or named pipe.
|
||||
* @param no_truncate Force an error rather than allow truncating a path.
|
||||
* @return Underlying return value.
|
||||
*/
|
||||
int connect(const std::string &name);
|
||||
int connect(const std::string &name, const bool no_truncate = false);
|
||||
|
||||
/**
|
||||
* @brief Gets the name of the Unix domain socket or the named pipe.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user