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
master
David Lawrence Ramsey 2006-04-05 21:25:47 +00:00
parent b0588ae45e
commit 979de2309b
3 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,8 @@ CVS code -
do_last_file(), do_help_void(), and do_browser_help(); changes do_last_file(), do_help_void(), and do_browser_help(); changes
to do_browser(), parse_browser_input(), shortcut_init(), to do_browser(), parse_browser_input(), shortcut_init(),
do_help(), and help_init(). (DLR) 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: - files.c:
write_file() write_file()
- Don't free backupname before displaying it in a statusbar error - Don't free backupname before displaying it in a statusbar error

View File

@ -2342,7 +2342,7 @@ void load_history(void)
/* Assume do_rcfile() has reported a missing home directory. */ /* Assume do_rcfile() has reported a missing home directory. */
if (nanohist != NULL) { if (nanohist != NULL) {
FILE *hist = fopen(nanohist, "r"); FILE *hist = fopen(nanohist, "rb");
if (hist == NULL) { if (hist == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {

View File

@ -760,7 +760,7 @@ void do_rcfile(void)
#ifdef SYSCONFDIR #ifdef SYSCONFDIR
nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc"); nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
/* Try to open the system-wide nanorc. */ /* Try to open the system-wide nanorc. */
rcstream = fopen(nanorc, "r"); rcstream = fopen(nanorc, "rb");
if (rcstream != NULL) if (rcstream != NULL)
parse_rcfile(rcstream); parse_rcfile(rcstream);
#endif #endif
@ -780,7 +780,7 @@ void do_rcfile(void)
else { else {
nanorc = charealloc(nanorc, strlen(homedir) + 9); nanorc = charealloc(nanorc, strlen(homedir) + 9);
sprintf(nanorc, "%s/.nanorc", homedir); sprintf(nanorc, "%s/.nanorc", homedir);
rcstream = fopen(nanorc, "r"); rcstream = fopen(nanorc, "rb");
if (rcstream == NULL) { if (rcstream == NULL) {
/* Don't complain about the file's not existing. */ /* Don't complain about the file's not existing. */