nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 64a8f1930eeedc3d897172f65d4c582482831122
parent 0ac2dfd920c2e41445b3514419003c5635069f1f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue,  7 Sep 2021 16:44:08 +0200

history: emit a warning when file cannot be made private  [coverity]

Diffstat:
Msrc/history.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/history.c b/src/history.c @@ -367,7 +367,8 @@ void save_history(void) } /* Don't allow others to read or write the history file. */ - chmod(histname, S_IRUSR | S_IWUSR); + if (chmod(histname, S_IRUSR | S_IWUSR) < 0) + jot_error(N_("Cannot limit permissions on %s: %s"), histname, strerror(errno)); if (!write_list(searchtop, histfile) || !write_list(replacetop, histfile) || !write_list(executetop, histfile)) @@ -465,7 +466,8 @@ void save_poshistory(void) } /* Don't allow others to read or write the history file. */ - chmod(poshistname, S_IRUSR | S_IWUSR); + if (chmod(poshistname, S_IRUSR | S_IWUSR) < 0) + jot_error(N_("Cannot limit permissions on %s: %s"), poshistname, strerror(errno)); for (posptr = position_history; posptr != NULL; posptr = posptr->next) { char *path_and_place;