]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
fix various -Wall warnings
[apt.git] / methods / http.cc
index 068d26978186b06e35a1173775ddda2d6c3722d9..b3c791fa0a0e2fd555e81b4361dd7076b08e88bf 100644 (file)
@@ -368,8 +368,8 @@ bool ServerState::Close()
                                                                        /*}}}*/
 // ServerState::RunHeaders - Get the headers before the data           /*{{{*/
 // ---------------------------------------------------------------------
-/* Returns 0 if things are OK, 1 if an IO error occursed and 2 if a header
-   parse error occured */
+/* Returns 0 if things are OK, 1 if an IO error occurred and 2 if a header
+   parse error occurred */
 int ServerState::RunHeaders()
 {
    State = Header;
@@ -941,7 +941,8 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
    if (Srv->StartPos >= 0)
    {
       Res.ResumePoint = Srv->StartPos;
-      ftruncate(File->Fd(),Srv->StartPos);
+      if (ftruncate(File->Fd(),Srv->StartPos) < 0)
+        _error->Errno("ftruncate", _("Failed to truncate file"));
    }
       
    // Set the start point
@@ -1164,25 +1165,24 @@ int HttpMethod::Loop()
               URIDone(Res);
            }
            else
-               {
-                 if (Server->ServerFd == -1)
+           {
+              if (Server->ServerFd == -1)
+              {
+                 FailCounter++;
+                 _error->Discard();
+                 Server->Close();
+                 
+                 if (FailCounter >= 2)
                  {
-                         FailCounter++;
-                         _error->Discard();
-                         Server->Close();
-           
-                         if (FailCounter >= 2)
-                         {
-                                 Fail(_("Connection failed"),true);
-                                 FailCounter = 0;
-                         }
-           
-                         QueueBack = Queue;
+                    Fail(_("Connection failed"),true);
+                    FailCounter = 0;
                  }
-                 else
-                         Fail(true);
-               }
-
+                 
+                 QueueBack = Queue;
+              }
+              else
+                 Fail(true);
+           }
            break;
         }