index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aaron Griffin <aaron@archlinux.org> | 2007-03-04 09:08:54 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-03-04 09:08:54 +0000 |
commit | cdb46ef3fa6d2bea95ae45b8b807497982b18fd5 (patch) | |
tree | 0f2340ed62be9f99f1e4bf0764c65aad1e701964 /lib/libalpm/md5driver.c | |
parent | a7d7c963579176dfefe424931a57e86bc8b51924 (diff) |
-rw-r--r-- | lib/libalpm/md5driver.c | 20 |
diff --git a/lib/libalpm/md5driver.c b/lib/libalpm/md5driver.c index 2effa5f7..968caed8 100644 --- a/lib/libalpm/md5driver.c +++ b/lib/libalpm/md5driver.c @@ -48,7 +48,7 @@ char* _alpm_MDFile(char *filename) ALPM_LOG_FUNC; if((file = fopen(filename, "rb")) == NULL) { - printf (_("%s can't be opened\n"), filename); + _alpm_log(PM_LOG_ERROR, _("%s can't be opened\n"), filename); } else { char *ret; int i; @@ -59,28 +59,16 @@ char* _alpm_MDFile(char *filename) } MDFinal(digest, &context); fclose(file); - /*printf("MD5 (%s) = ", filename); - MDPrint(digest); - printf("\n");*/ - ret = (char*)malloc(33); - ret[0] = '\0'; + ret = calloc(33, sizeof(char)); for(i = 0; i < 16; i++) { - sprintf(ret, "%s%02x", ret, digest[i]); + sprintf(ret+(i*2), "%02x", digest[i]); } + _alpm_log(PM_LOG_DEBUG, _("sha1(%s) = %s"), filename, ret); return(ret); } return(NULL); } -/* Prints a message digest in hexadecimal. - */ -void _alpm_MDPrint(unsigned char digest[16]) -{ - unsigned int i; - for (i = 0; i < 16; i++) - printf ("%02x", digest[i]); -} - /* vim: set ts=2 sw=2 noet: */ |