From 979de2309bbe3cebd5f630629a184e3f56d8f257 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Wed, 5 Apr 2006 21:25:47 +0000 Subject: [PATCH] open all files in binary mode for consistency and robustness git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3352 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/files.c | 2 +- src/rcfile.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7992a7f6..c9ec7718 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ CVS code - do_last_file(), do_help_void(), and do_browser_help(); changes to do_browser(), parse_browser_input(), shortcut_init(), do_help(), and help_init(). (DLR) + - Open all files in binary mode for consistency and robustness. + Changes to load_history() and do_rcfile(). (DLR) - files.c: write_file() - Don't free backupname before displaying it in a statusbar error diff --git a/src/files.c b/src/files.c index 4c234d82..a147407d 100644 --- a/src/files.c +++ b/src/files.c @@ -2342,7 +2342,7 @@ void load_history(void) /* Assume do_rcfile() has reported a missing home directory. */ if (nanohist != NULL) { - FILE *hist = fopen(nanohist, "r"); + FILE *hist = fopen(nanohist, "rb"); if (hist == NULL) { if (errno != ENOENT) { diff --git a/src/rcfile.c b/src/rcfile.c index 120fee9e..50848535 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -760,7 +760,7 @@ void do_rcfile(void) #ifdef SYSCONFDIR nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc"); /* Try to open the system-wide nanorc. */ - rcstream = fopen(nanorc, "r"); + rcstream = fopen(nanorc, "rb"); if (rcstream != NULL) parse_rcfile(rcstream); #endif @@ -780,7 +780,7 @@ void do_rcfile(void) else { nanorc = charealloc(nanorc, strlen(homedir) + 9); sprintf(nanorc, "%s/.nanorc", homedir); - rcstream = fopen(nanorc, "r"); + rcstream = fopen(nanorc, "rb"); if (rcstream == NULL) { /* Don't complain about the file's not existing. */ -- 2.39.5