commit a0faec76c1ca1d5e829f04d65b45b8c9d032383a from: Stefan Sperling date: Tue Aug 01 14:01:09 2023 UTC important regression fix: do not truncate config files in /etc Tom Smyth found during testing that when editing config files via the "edit" ctl commands we would always truncate existing files in /etc. And thus always see an empty file to load an example for. Fix this by passing the correct mode to fopen(): a+ instead of w+ Committing right now to prevent data loss. People running nsh built from the previous commit 574d5c2d6a16ae5600d65fedc157d03e7fcfdd43 should update. commit - 574d5c2d6a16ae5600d65fedc157d03e7fcfdd43 commit + a0faec76c1ca1d5e829f04d65b45b8c9d032383a blob - 1fc6dd7d7f57306bb861c4d7e29798c158b0f32b blob + 4011e0f3cb3a14e6359f82f82497db29b47dcd89 --- ctl.c +++ ctl.c @@ -832,7 +832,7 @@ provide_example_config(char *filename) memset(tmpprompt, 0, sizeof(tmpprompt)); - f = fopen(filename, "w+"); + f = fopen(filename, "a+"); if (f == NULL) return;