From cdb46ef3fa6d2bea95ae45b8b807497982b18fd5 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Sun, 4 Mar 2007 09:08:54 +0000 Subject: * Fixed a whole mess of extra '/' pathing issues when a different root is specified * Use db->path when appropriate * Commented out the FAKEROOT checks in libalpm. This should never ever be done. TODO test this quite a bit, as this will never cause the transactions to fail if RW operations are requested... right now it is totally up to the front end to decide when to fail * Use realpath() to canonicalize the root path when specified, so _alpm_makepath() doesn't freak out * Fixed some output/indent of MDFile and SHAFile algorithms * More efficient sprintf() usage in MDFile/SHAFile * Added real error output to _alpm_makepath --- lib/libalpm/md5driver.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'lib/libalpm/md5driver.c') 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: */ -- cgit v1.2.3-24-g4f1b