diff --git a/lib/utils.c b/lib/utils.c index 6b15abbb8..3e4309792 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -437,8 +437,10 @@ int sha1sum(FILE *f, unsigned char *sha1) SHA_CTX c; char buf[512]; ssize_t bytes; + long seek; - rewind(f); /* Rewind the file in order to calculate over the whole file. */ + seek = ftell(f); + fseek(f, 0, SEEK_SET); SHA1_Init(&c); @@ -449,6 +451,8 @@ int sha1sum(FILE *f, unsigned char *sha1) } SHA1_Final(sha1, &c); + + fseek(f, seek, SEEK_SET); return 0; } \ No newline at end of file