X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=stream.cpp;h=ab08a0f7ad85f34d458e9c41b40bbf5d7ccfe721;hb=0cb56be70f7ca4f4564eea892a99d20032359a1d;hp=109d2fd4a90116398e8b638816872cabf06b22ce;hpb=534764f026b82b144e974882c8e53c4cd8d21b68;p=cubemap diff --git a/stream.cpp b/stream.cpp index 109d2fd..ab08a0f 100644 --- a/stream.cpp +++ b/stream.cpp @@ -1,14 +1,15 @@ -#include +#include #include -#include +#include #include +#include #include #include #include -#include "state.pb.h" #include "log.h" #include "metacube.h" +#include "state.pb.h" #include "stream.h" #include "util.h" @@ -30,13 +31,7 @@ Stream::Stream(const string &stream_id, size_t backlog_size, Encoding encoding) Stream::~Stream() { if (data_fd != -1) { - int ret; - do { - ret = close(data_fd); - } while (ret == -1 && errno == EINTR); - if (ret == -1) { - log_perror("close"); - } + safe_close(data_fd); } } @@ -109,6 +104,9 @@ void Stream::set_backlog_size(size_t new_size) // Create a new, empty data file. data_fd = make_tempfile(""); + if (data_fd == -1) { + exit(1); + } backlog_size = new_size; // Now cheat a bit by rewinding, and adding all the old data back.