From f113371523bc26e320e5ef8799e6ab123af9618e Mon Sep 17 00:00:00 2001 From: forever2k38 Date: Wed, 30 Sep 2026 22:01:45 +0200 Subject: initial install support, better readme, relicense, and more! --- src/hash.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/hash.c') diff --git a/src/hash.c b/src/hash.c index 2cb0851..b302cb7 100644 --- a/src/hash.c +++ b/src/hash.c @@ -1,4 +1,26 @@ +/* + + pow! - the pow!erful package manager + + Copyright (C) 2026 forever2k38 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + #include "hash.h" +#include "log.h" #include #include @@ -10,7 +32,7 @@ int pow_check_blake2b_hash(char *path, char *target_hash) { FILE *fp = fopen(path, "rb"); if (!fp) { - printf("failed to open file to check hash\n"); + pow_log_error("failed to open file to check hash"); return 1; } @@ -20,7 +42,7 @@ int pow_check_blake2b_hash(char *path, char *target_hash) { fseek(fp, 0, SEEK_SET); if (fsize < 0) { - printf("error: ftell\n"); + pow_log_error("error: ftell"); fclose(fp); @@ -33,13 +55,13 @@ int pow_check_blake2b_hash(char *path, char *target_hash) { buf = malloc((size_t)fsize); if (!buf) { - fprintf(stderr, "out of memory\n"); + pow_log_error("out of memory"); fclose(fp); return 1; } if (fread(buf, 1, (size_t)fsize, fp) != (size_t)fsize) { - fprintf(stderr, "read error\n"); + pow_log_error("read error"); free(buf); fclose(fp); return 1; @@ -50,7 +72,7 @@ int pow_check_blake2b_hash(char *path, char *target_hash) { uint8_t digest[BLAKE2B_OUTBYTES]; if (blake2b(digest, buf, NULL, BLAKE2B_OUTBYTES, (size_t)fsize, 0) != 0) { - fprintf(stderr, "blake2b failed\n"); + pow_log_error("blake2b failed"); free(buf); return 1; } -- cgit v1.3