Teach Git to respect skip-worktree bit (writing part)
[gitweb.git] / http.c
diff --git a/http.c b/http.c
index 98f9707625dd1e28dc3206f76ab27b231c1425a9..14d535747d943c2db3d45d82439f3ee9633ed2d9 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1187,7 +1187,11 @@ struct http_object_request *new_http_object_request(const char *base_url,
                if (prev_posn>0) {
                        prev_posn = 0;
                        lseek(freq->localfile, 0, SEEK_SET);
-                       ftruncate(freq->localfile, 0);
+                       if (ftruncate(freq->localfile, 0) < 0) {
+                               error("Couldn't truncate temporary file %s for %s: %s",
+                                         freq->tmpfile, freq->filename, strerror(errno));
+                               goto abort;
+                       }
                }
        }