Fossil SCM
Fix segfault in status, et al, when a file in the checkout cannot be opened.
Commit
3c6d23b75293022a1bfcdf0ff1793cc09df9414d592afdf814a541bf67ea701c
Parent
2eea7584d57b80c…
1 file changed
+2
-2
+2
-2
| --- src/hname.c | ||
| +++ src/hname.c | ||
| @@ -133,18 +133,18 @@ | ||
| 133 | 133 | int hname_verify_file_hash(const char *zFile, const char *zHash, int nHash){ |
| 134 | 134 | int id = HNAME_ERROR; |
| 135 | 135 | switch( nHash ){ |
| 136 | 136 | case HNAME_LEN_SHA1: { |
| 137 | 137 | Blob hash; |
| 138 | - sha1sum_file(zFile, &hash); | |
| 138 | + if( sha1sum_file(zFile, &hash) ) break; | |
| 139 | 139 | if( memcmp(blob_buffer(&hash),zHash,HNAME_LEN_SHA1)==0 ) id = HNAME_SHA1; |
| 140 | 140 | blob_reset(&hash); |
| 141 | 141 | break; |
| 142 | 142 | } |
| 143 | 143 | case HNAME_LEN_K256: { |
| 144 | 144 | Blob hash; |
| 145 | - sha3sum_file(zFile, 256, &hash); | |
| 145 | + if( sha3sum_file(zFile, 256, &hash) ) break; | |
| 146 | 146 | if( memcmp(blob_buffer(&hash),zHash,64)==0 ) id = HNAME_LEN_K256; |
| 147 | 147 | blob_reset(&hash); |
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -133,18 +133,18 @@ | |
| 133 | int hname_verify_file_hash(const char *zFile, const char *zHash, int nHash){ |
| 134 | int id = HNAME_ERROR; |
| 135 | switch( nHash ){ |
| 136 | case HNAME_LEN_SHA1: { |
| 137 | Blob hash; |
| 138 | sha1sum_file(zFile, &hash); |
| 139 | if( memcmp(blob_buffer(&hash),zHash,HNAME_LEN_SHA1)==0 ) id = HNAME_SHA1; |
| 140 | blob_reset(&hash); |
| 141 | break; |
| 142 | } |
| 143 | case HNAME_LEN_K256: { |
| 144 | Blob hash; |
| 145 | sha3sum_file(zFile, 256, &hash); |
| 146 | if( memcmp(blob_buffer(&hash),zHash,64)==0 ) id = HNAME_LEN_K256; |
| 147 | blob_reset(&hash); |
| 148 | break; |
| 149 | } |
| 150 | } |
| 151 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -133,18 +133,18 @@ | |
| 133 | int hname_verify_file_hash(const char *zFile, const char *zHash, int nHash){ |
| 134 | int id = HNAME_ERROR; |
| 135 | switch( nHash ){ |
| 136 | case HNAME_LEN_SHA1: { |
| 137 | Blob hash; |
| 138 | if( sha1sum_file(zFile, &hash) ) break; |
| 139 | if( memcmp(blob_buffer(&hash),zHash,HNAME_LEN_SHA1)==0 ) id = HNAME_SHA1; |
| 140 | blob_reset(&hash); |
| 141 | break; |
| 142 | } |
| 143 | case HNAME_LEN_K256: { |
| 144 | Blob hash; |
| 145 | if( sha3sum_file(zFile, 256, &hash) ) break; |
| 146 | if( memcmp(blob_buffer(&hash),zHash,64)==0 ) id = HNAME_LEN_K256; |
| 147 | blob_reset(&hash); |
| 148 | break; |
| 149 | } |
| 150 | } |
| 151 |