diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-04-28 08:25:41 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-04-28 08:25:41 +0300 |
commit | 1782040d87f67a241fb59170b803e7f798f1bfa8 (patch) | |
tree | c1a82b121613c010d86a3e86dda2f15c12e97a60 | |
parent | 00def6983539e1401eab23f5cd4f3ffca0399853 (diff) | |
download | arching-kaos-tools-1782040d87f67a241fb59170b803e7f798f1bfa8.tar.gz arching-kaos-tools-1782040d87f67a241fb59170b803e7f798f1bfa8.tar.bz2 arching-kaos-tools-1782040d87f67a241fb59170b803e7f798f1bfa8.zip |
gc
-rw-r--r-- | c_implementation/src/ak_fs_map_v3.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/c_implementation/src/ak_fs_map_v3.c b/c_implementation/src/ak_fs_map_v3.c index 994806c..6774f65 100644 --- a/c_implementation/src/ak_fs_map_v3.c +++ b/c_implementation/src/ak_fs_map_v3.c @@ -201,50 +201,6 @@ int ak_fs_map_v3_open_from_file(akfs_map_v3 * map) return 0; } -int ak_fs_open_map_v3_file(char* maphash, akfs_map_v3 * map) -{ - ak_log_debug(__func__, "Started"); - if (map==0x0) - { - ak_log_debug(__func__, "Zeropointer"); - return 1; - } - if ( !ak_fs_verify_input_is_hash(maphash, strlen(maphash)) ) - { - ak_log_debug(__func__,"not a hash"); - return 1; - } - FILE *fd; - char *full_path = {0}; - asprintf(&full_path, "%s/%s", ak_fs_maps_v3_get_dir(), maphash); - printf("Trying path: %s\n", full_path); - fd = fopen(full_path, "rb"); - if (!fd) - { - // perror("fopen"); - ak_log_debug(__func__, "file not found"); - return 1; - } - struct stat sb; - if (stat(full_path, &sb) == -1) { - perror("stat"); - fclose(fd); - return 2; - } - // File size: %lld in bytes: (long long) sb.st_size); - char buffer[(long long) sb.st_size+1]; - fread(&buffer, sizeof(buffer), (long long) sb.st_size, fd); - ak_fs_sha512sum_string_to_struct(maphash, &(map->mh)); - if ( ak_fs_convert_map_v3_string_to_struct(buffer, strlen(buffer), map) != 0 ) - { - ak_log_debug(__func__,"conversion failed"); - fclose(fd); - return 1; - } - fclose(fd); - return 0; -} - int ak_fs_map_v3_to_file(akfs_map_v3 maphash) { (void)maphash; |