[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 98/151: curl: make the etag load logic work without fseek
From: |
gnunet |
Subject: |
[gnurl] 98/151: curl: make the etag load logic work without fseek |
Date: |
Fri, 20 Dec 2019 14:26:47 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 147fa0689124e7b5a61afea2e7db673d8c89934f
Author: Daniel Stenberg <address@hidden>
AuthorDate: Fri Dec 6 17:24:52 2019 +0100
curl: make the etag load logic work without fseek
The fseek()s were unnecessary and caused Coverity warning CID 1456554
Closes #4681
---
src/tool_operate.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/src/tool_operate.c b/src/tool_operate.c
index e78cc4fd2..4c9b07e39 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -922,7 +922,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->etag_compare_file) {
char *etag_from_file = NULL;
char *header = NULL;
- size_t file_size = 0;
/* open file for reading: */
FILE *file = fopen(config->etag_compare_file, FOPEN_READTEXT);
@@ -935,23 +934,11 @@ static CURLcode single_transfer(struct GlobalConfig
*global,
break;
}
- /* get file size */
- fseek(file, 0, SEEK_END);
- file_size = ftell(file);
-
- /*
- * check if file is empty, if it's not load etag
- * else continue with empty etag
- */
- if(file_size != 0) {
- fseek(file, 0, SEEK_SET);
- file2string(&etag_from_file, file);
-
+ if((PARAM_OK == file2string(&etag_from_file, file)) &&
+ etag_from_file)
header = aprintf("If-None-Match: \"%s\"", etag_from_file);
- }
- else {
+ else
header = aprintf("If-None-Match: \"\"");
- }
if(!header) {
warnf(
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 109/151: travis: remove "coverage", make it "torture", (continued)
- [gnurl] 109/151: travis: remove "coverage", make it "torture", gnunet, 2019/12/20
- [gnurl] 77/151: azure-pipelines: fix the test script, gnunet, 2019/12/20
- [gnurl] 73/151: build: Disable Visual Studio warning "conditional expression is constant", gnunet, 2019/12/20
- [gnurl] 79/151: OPENSOCKETFUNCTION.3: correct the purpose description, gnunet, 2019/12/20
- [gnurl] 84/151: curl_setup: disable IPv6 resolver without `getaddrinfo`, gnunet, 2019/12/20
- [gnurl] 80/151: curl: show better error message when no homedir is found, gnunet, 2019/12/20
- [gnurl] 83/151: github action/azure pipeline: run 'make test-nonflaky' for tests, gnunet, 2019/12/20
- [gnurl] 82/151: openssl: CURLSSLOPT_NO_PARTIALCHAIN can disable partial cert chains, gnunet, 2019/12/20
- [gnurl] 85/151: configure: enable IPv6 support without `getaddrinfo`, gnunet, 2019/12/20
- [gnurl] 87/151: CURLOPT_VERBOSE.3: see also ERRORBUFFER, gnunet, 2019/12/20
- [gnurl] 98/151: curl: make the etag load logic work without fseek,
gnunet <=
- [gnurl] 103/151: winbuild: Define CARES_STATICLIB when WITH_CARES=static, gnunet, 2019/12/20
- [gnurl] 90/151: test342: make it return a 304 as the tag matches, gnunet, 2019/12/20
- [gnurl] 99/151: azure: add a vanilla macos build, gnunet, 2019/12/20
- [gnurl] 105/151: tests: fix permissions of ssh keys in WSL, gnunet, 2019/12/20
- [gnurl] 102/151: conn: always set bits.close with connclose(), gnunet, 2019/12/20
- [gnurl] 116/151: curl: improved cleanup in upload error path, gnunet, 2019/12/20
- [gnurl] 108/151: azure: add libssh2 and cmake macos builds, gnunet, 2019/12/20
- [gnurl] 107/151: curl: use errorf() better, gnunet, 2019/12/20
- [gnurl] 114/151: travis: make torture use --shallow=40, gnunet, 2019/12/20
- [gnurl] 119/151: altsvc: make the save function ignore NULL filenames, gnunet, 2019/12/20