diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-01-04 17:05:05 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-01-04 17:05:05 +0100 |
commit | f46c107278b96264b2e5302b4ebb050f73abf869 (patch) | |
tree | f2bd74b81fa33546e513b2eabf7a790eb3b631e8 /src/util/crypto_hash_file.c | |
parent | e20eca334a33b8340524a8fa6ad1d6b606e1dd0c (diff) | |
download | gnunet-f46c107278b96264b2e5302b4ebb050f73abf869.tar.gz gnunet-f46c107278b96264b2e5302b4ebb050f73abf869.zip |
trying again to fix test_service timeout on v6 failure
Diffstat (limited to 'src/util/crypto_hash_file.c')
-rw-r--r-- | src/util/crypto_hash_file.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/util/crypto_hash_file.c b/src/util/crypto_hash_file.c index 3e5900200..cb632d02c 100644 --- a/src/util/crypto_hash_file.c +++ b/src/util/crypto_hash_file.c | |||
@@ -124,23 +124,29 @@ file_hash_task (void *cls) | |||
124 | struct GNUNET_CRYPTO_FileHashContext *fhc = cls; | 124 | struct GNUNET_CRYPTO_FileHashContext *fhc = cls; |
125 | struct GNUNET_HashCode *res; | 125 | struct GNUNET_HashCode *res; |
126 | size_t delta; | 126 | size_t delta; |
127 | ssize_t sret; | ||
127 | 128 | ||
128 | fhc->task = NULL; | 129 | fhc->task = NULL; |
129 | GNUNET_assert (fhc->offset <= fhc->fsize); | 130 | GNUNET_assert (fhc->offset <= fhc->fsize); |
130 | delta = fhc->bsize; | 131 | delta = fhc->bsize; |
131 | if (fhc->fsize - fhc->offset < delta) | 132 | if (fhc->fsize - fhc->offset < delta) |
132 | delta = fhc->fsize - fhc->offset; | 133 | delta = fhc->fsize - fhc->offset; |
133 | if (delta != GNUNET_DISK_file_read (fhc->fh, | 134 | sret = GNUNET_DISK_file_read (fhc->fh, |
134 | fhc->buffer, | 135 | fhc->buffer, |
135 | delta)) | 136 | delta); |
137 | if ( (sret < 0) || | ||
138 | (delta != (size_t) sret) ) | ||
136 | { | 139 | { |
137 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, | 140 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, |
138 | "read", | 141 | "read", |
139 | fhc->filename); | 142 | fhc->filename); |
140 | file_hash_finish (fhc, NULL); | 143 | file_hash_finish (fhc, |
144 | NULL); | ||
141 | return; | 145 | return; |
142 | } | 146 | } |
143 | gcry_md_write (fhc->md, fhc->buffer, delta); | 147 | gcry_md_write (fhc->md, |
148 | fhc->buffer, | ||
149 | delta); | ||
144 | fhc->offset += delta; | 150 | fhc->offset += delta; |
145 | if (fhc->offset == fhc->fsize) | 151 | if (fhc->offset == fhc->fsize) |
146 | { | 152 | { |