Merge remote-tracking branch 'lenormf/fix-unused-result'
This commit is contained in:
commit
1ed866dbf0
|
@ -100,7 +100,9 @@ String compact_path(StringView filename)
|
|||
String real_filename = real_path(filename);
|
||||
|
||||
char cwd[1024];
|
||||
getcwd(cwd, 1024);
|
||||
if (!::getcwd(cwd, 1024))
|
||||
throw runtime_error(format("unable to get the current working directory (errno: {})", ::strerror(errno)));
|
||||
|
||||
String real_cwd = real_path(cwd) + "/";
|
||||
if (prefix_match(real_filename, real_cwd))
|
||||
return real_filename.substr(real_cwd.length()).str();
|
||||
|
@ -223,7 +225,8 @@ void write_buffer_to_fd(Buffer& buffer, int fd)
|
|||
eoldata = "\n";
|
||||
|
||||
if (buffer.options()["BOM"].get<ByteOrderMark>() == ByteOrderMark::Utf8)
|
||||
::write(fd, "\xEF\xBB\xBF", 3);
|
||||
if (::write(fd, "\xEF\xBB\xBF", 3) < 0)
|
||||
throw runtime_error(format("unable to write data to the buffer (fd: {}; errno: {})", fd, ::strerror(errno)));
|
||||
|
||||
for (LineCount i = 0; i < buffer.line_count(); ++i)
|
||||
{
|
||||
|
|
|
@ -532,7 +532,8 @@ void RemoteClient::write_next_key()
|
|||
void send_command(StringView session, StringView command)
|
||||
{
|
||||
int sock = connect_to(session);
|
||||
::write(sock, command.data(), (int)command.length());
|
||||
if (::write(sock, command.data(), (int)command.length()) < 0)
|
||||
throw runtime_error(format("unable to write data to socket (fd: {}; errno: {})", sock, ::strerror(errno)));
|
||||
close(sock);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ namespace
|
|||
|
||||
struct Pipe
|
||||
{
|
||||
Pipe() { ::pipe(m_fd); }
|
||||
Pipe() {
|
||||
if (::pipe(m_fd) < 0)
|
||||
throw runtime_error(format("unable to create pipe (fds: {}/{}; errno: {})", m_fd[0], m_fd[1], ::strerror(errno)));
|
||||
}
|
||||
~Pipe() { close_read_fd(); close_write_fd(); }
|
||||
|
||||
int read_fd() const { return m_fd[0]; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user