ソースを参照

fix "(style) Statements following return, break, continue, goto or throw
will never be executed." from cppcheck. The fd was closed only after a
return, so invert the order of lines and be happy

David Kalnischkies 14 年 前
コミット
f685054e7e
共有1 個のファイルを変更した2 個の追加4 個の削除を含む
  1. 2 4
      apt-inst/dirstream.cc

+ 2 - 4
apt-inst/dirstream.cc

@@ -46,15 +46,13 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd)
 	 // fchmod deals with umask and fchown sets the ownership
 	 if (fchmod(iFd,Itm.Mode) != 0)
 	 {
-	    _error->Errno("fchmod",_("Failed to write file %s"), Itm.Name);
 	    close(iFd);
-	    return false;
+	    return _error->Errno("fchmod",_("Failed to write file %s"), Itm.Name);
 	 }
 	 if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
 	 {
-	    return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name);
 	    close(iFd);
-	    return false;
+	    return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name);
 	 }
 	 Fd = iFd;
 	 return true;