]> granicus.if.org Git - pdns/commitdiff
silence some warning about not checking return value of write() to console. Thanks...
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 4 Apr 2011 13:18:52 +0000 (13:18 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 4 Apr 2011 13:18:52 +0000 (13:18 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2142 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dynlistener.cc

index e36dfa7d6a58bc826a935ba5bf571a4a9b810f31..b047a07e4d114c0c74e687edae596186fbbc875c 100644 (file)
@@ -227,7 +227,8 @@ string DynListener::getLine()
   }
   else {
     if(isatty(0))
-      write(1, "% ", 2);
+      if(write(1, "% ", 2) !=2)
+        throw AhuException("Writing to console: "+stringerror());
     if((len=read(0, &mesg[0], mesg.size())) < 0) 
       throw AhuException("Reading from the control pipe: "+stringerror());
     else if(len==0)
@@ -263,7 +264,9 @@ void DynListener::sendLine(const string &l)
     if(!line.empty() && line[line.length()-1]!='\n')
       line.append("\n");
     line.append("\n");
-    write(1,line.c_str(),line.length());
+    if(write(1,line.c_str(),line.length()) != line.length())
+      L<<Logger::Error<<"Error sending data to console: "<<stringerror()<<endl;
+      
   }
 }