]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gostsum.c
tcl_tests: ca.try: Ignore openssl crl exit status for 'corrupted CRL' test
[openssl-gost/engine.git] / gostsum.c
index aed2a478f7a6aeb5c3dc55c731d463c7a75bf225..b61215c9f08cb8ab05feb7ff9e57d653967a5c1e 100644 (file)
--- a/gostsum.c
+++ b/gostsum.c
@@ -9,7 +9,16 @@
  **********************************************************************/
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef _MSC_VER
+#include "getopt.h"
+# ifndef PATH_MAX
+#  define PATH_MAX _MAX_PATH
+# endif
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#else
 #include <unistd.h>
+#endif
 #include <limits.h>
 #include <fcntl.h>
 #ifdef _WIN32
@@ -77,7 +86,8 @@ int main(int argc, char **argv)
     init_gost_hash_ctx(&ctx, b);
     if (check_file) {
         char inhash[65], calcsum[65], filename[PATH_MAX];
-        int failcount = 0, count = 0, errors = 0;
+        int failcount = 0, count = 0;
+        errors = 0;
         if (check_file == stdin && optind < argc) {
             check_file = fopen(argv[optind], "r");
             if (!check_file) {
@@ -153,6 +163,7 @@ int hash_file(gost_hash_ctx * ctx, char *filename, char *sum, int mode)
     }
     if (!hash_stream(ctx, fd, sum)) {
         perror(filename);
+        close(fd);
         return 0;
     }
     close(fd);