]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fixed coverity issues
authorAki Tuomi <cmouse@desteem.org>
Tue, 9 Jul 2013 07:00:00 +0000 (10:00 +0300)
committerAki Tuomi <cmouse@desteem.org>
Tue, 9 Jul 2013 07:29:45 +0000 (10:29 +0300)
modules/remotebackend/unixconnector.cc

index 801ed275e137e2fdc04e30c6a9a59cb88e2327d2..ff7080d07ca7d6d0dc89f81287481b95e1bafb6e 100644 (file)
@@ -19,6 +19,7 @@ UnixsocketConnector::UnixsocketConnector(std::map<std::string,std::string> optio
    this->path = options.find("path")->second;
    this->options = options;
    this->connected = false;
+   this->fd = -1;
 }
 
 UnixsocketConnector::~UnixsocketConnector() {
@@ -134,7 +135,12 @@ void UnixsocketConnector::reconnect() {
    sock.sun_family = AF_UNIX;
    memset(sock.sun_path, 0, UNIX_PATH_MAX);
    path.copy(sock.sun_path, UNIX_PATH_MAX, 0);
-   fcntl(fd, F_SETFL, O_NONBLOCK, &fd);
+   if (fcntl(fd, F_SETFL, O_NONBLOCK, &fd)) {
+      connected = false;
+      L<<Logger::Error<<"Cannot manipulate socket: " << strerror(errno) << std::endl;;
+      close(fd);
+      return;
+   }
 
    while(connect(fd, reinterpret_cast<struct sockaddr*>(&sock), sizeof sock)==-1 && (errno == EINPROGRESS)) {
      waitForData(fd, 0, 500);