From bf8942b55eb9562cebf8f8bb7df663444d5d058e Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 23 Jul 2017 09:36:50 +0200 Subject: [PATCH] Configuration variable and section delete functions now only set the first character of the name to ASCII 0x00 rather than zeroing the entire array, fixes hard disk corruption bug on floppy mount. --- src/config.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 9821b3f5a..2ebc6d3da 100644 --- a/src/config.c +++ b/src/config.c @@ -471,7 +471,8 @@ void config_delete_var(char *head, char *name) if (!entry) return; - memset(entry->name, 0, strlen(entry->name)); + /* memset(entry->name, 0, strlen(entry->name)); */ + entry->name[0] = 0; return; } @@ -488,7 +489,8 @@ void config_delete_section_if_empty(char *head) if (entries_num(section) == 0) { - memset(section->name, 0, strlen(section->name)); + /* memset(section->name, 0, strlen(section->name)); */ + section->name[0] = 0; } return; @@ -742,7 +744,7 @@ void config_save(wchar_t *fn) while (current_entry) { - if(strlen(current_entry->name) > 0) + if(current_entry->name[0]) { mbstowcs(wname, current_entry->name, strlen(current_entry->name) + 1); if (current_entry->wdata[0] == L'\0')