Version v0.3.22 - Fix delete error

This commit is contained in:
2025-12-18 08:45:16 -04:00
parent 05f5d6ca4f
commit 3ff91e7681
5 changed files with 19 additions and 6291 deletions

2
.gitignore vendored
View File

@@ -5,5 +5,5 @@ Gemini.md
TropicOfCancer-HenryMiller.txt TropicOfCancer-HenryMiller.txt
.gitea_token .gitea_token
true_rng/ true_rng/
Trash/
# Auto-generated files (none currently) # Auto-generated files (none currently)

6278
otp copy.c

File diff suppressed because it is too large Load Diff

BIN
otp-arm64

Binary file not shown.

Binary file not shown.

View File

@@ -22,11 +22,13 @@
// Extracted pad management functions from otp.c // Extracted pad management functions from otp.c
int show_pad_info(const char* chksum) { int show_pad_info(const char* chksum) {
char pad_filename[MAX_HASH_LENGTH + 10]; char pad_filename[1024];
char state_filename[MAX_HASH_LENGTH + 10]; char state_filename[1024];
snprintf(pad_filename, sizeof(pad_filename), "%s.pad", chksum); // Use full paths with pads directory
snprintf(state_filename, sizeof(state_filename), "%s.state", chksum); const char* pads_dir = get_current_pads_dir();
snprintf(pad_filename, sizeof(pad_filename), "%s/%s.pad", pads_dir, chksum);
snprintf(state_filename, sizeof(state_filename), "%s/%s.state", pads_dir, chksum);
struct stat st; struct stat st;
if (stat(pad_filename, &st) != 0) { if (stat(pad_filename, &st) != 0) {
@@ -899,12 +901,14 @@ int update_pad_checksum_after_entropy(const char* old_chksum, char* new_chksum)
// Verify pad integrity by checking its checksum // Verify pad integrity by checking its checksum
int handle_verify_pad(const char* chksum) { int handle_verify_pad(const char* chksum) {
char pad_filename[MAX_HASH_LENGTH + 10]; char pad_filename[1024];
char state_filename[MAX_HASH_LENGTH + 10]; char state_filename[1024];
char calculated_chksum[MAX_HASH_LENGTH]; char calculated_chksum[MAX_HASH_LENGTH];
snprintf(pad_filename, sizeof(pad_filename), "%s.pad", chksum); // Use full paths with pads directory
snprintf(state_filename, sizeof(state_filename), "%s.state", chksum); const char* pads_dir = get_current_pads_dir();
snprintf(pad_filename, sizeof(pad_filename), "%s/%s.pad", pads_dir, chksum);
snprintf(state_filename, sizeof(state_filename), "%s/%s.state", pads_dir, chksum);
struct stat st; struct stat st;
if (stat(pad_filename, &st) != 0) { if (stat(pad_filename, &st) != 0) {
@@ -952,11 +956,13 @@ int handle_verify_pad(const char* chksum) {
// Delete a pad and its associated state file // Delete a pad and its associated state file
int handle_delete_pad(const char* chksum) { int handle_delete_pad(const char* chksum) {
char pad_filename[MAX_HASH_LENGTH + 10]; char pad_filename[1024];
char state_filename[MAX_HASH_LENGTH + 10]; char state_filename[1024];
snprintf(pad_filename, sizeof(pad_filename), "%s.pad", chksum); // Use full paths with pads directory
snprintf(state_filename, sizeof(state_filename), "%s.state", chksum); const char* pads_dir = get_current_pads_dir();
snprintf(pad_filename, sizeof(pad_filename), "%s/%s.pad", pads_dir, chksum);
snprintf(state_filename, sizeof(state_filename), "%s/%s.state", pads_dir, chksum);
// Check if pad exists // Check if pad exists
if (access(pad_filename, F_OK) != 0) { if (access(pad_filename, F_OK) != 0) {