Revision
597
Author
wsiegrist@apple.com
Date
2009-10-12 16:00:28 -0700 (Mon, 12 Oct 2009)

Log Message

Use ssize_t for reading since read() can return negative values.

Modified Paths

Diff

Modified: trunk/darwinbuild/manifest.c (596 => 597)


--- trunk/darwinbuild/manifest.c	2009-10-12 22:40:21 UTC (rev 596)
+++ trunk/darwinbuild/manifest.c	2009-10-12 23:00:28 UTC (rev 597)
@@ -77,7 +77,7 @@
 
 	EVP_DigestInit(&ctx, md);
 
-	unsigned int len;
+	ssize_t len;
 	const unsigned int blocklen = 8192;
 	static unsigned char* block = NULL;
 	if (block == NULL) {
@@ -88,10 +88,10 @@
 		if (len == 0) { close(fd); break; }
 		if ((len < 0) && (errno == EINTR)) continue;
 		if (len < 0) { close(fd); return NULL; }
-		EVP_DigestUpdate(&ctx, block, len);
+		EVP_DigestUpdate(&ctx, block, (size_t)len);
 	}
 
-	EVP_DigestFinal(&ctx, digstr, &len);
+	EVP_DigestFinal(&ctx, digstr, NULL);
 	return format_digest(digstr);
 }