From ae057d3e782cec3e2c559f0559d321acfcbd9288 Mon Sep 17 00:00:00 2001 From: Lekensteyn Date: Sun, 3 Jun 2012 12:17:41 +0200 Subject: [PATCH] buffer: Fail early and print diagnostic message When /tmp/mist/ was created before as a different user, and MistBuffer was started, it would print "End of input file - buffer shutting down". This is very confusing, therefore fail earlier and print a more useful message even if DEBUG is disabled. --- src/buffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/buffer.cpp b/src/buffer.cpp index da6a4f1d..f2eb3d66 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -188,6 +188,10 @@ namespace Buffer{ std::string name = argv[1]; SS = Socket::makeStream(name); + if (!SS.connected()) { + perror("Could not create stream socket"); + return 1; + } thisStream = Stream::get(); thisStream->setName(name); Socket::Connection incoming;