diff options
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) | |
download | pacman-cdb46ef3fa6d2bea95ae45b8b807497982b18fd5.tar.xz |
* 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
Diffstat (limited to 'lib/libalpm/md5driver.c')
-rw-r--r-- | lib/libalpm/md5driver.c | 20 |
1 files changed, 4 insertions, 16 deletions
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: */ |