From abcd5fe37b31b2e13907893f70a9e411dcf5e295 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 12 Aug 2018 11:48:52 -0600 Subject: * The call realpath(..., NULL) gives an error in Solaris, which means that we need to allocate memory for storing the resolved path. Reported by Fabian Schmidt. --- pith/conf.c | 22 +++++++++++++++------- pith/pine.hlp | 6 +++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pith/conf.c b/pith/conf.c index b75d8891..0085e955 100644 --- a/pith/conf.c +++ b/pith/conf.c @@ -5973,14 +5973,22 @@ write_pinerc(struct pine *ps, EditWhich which, int flags) if(so_give(&so)) goto io_err; #ifndef _WINDOWS - if ((realfilename = realpath(filename, NULL)) != NULL) - realfilename_malloced = 1; - else if(our_stat(filename, &sbuf) < 0 && errno == ENOENT){ - realfilename = filename; - realfilename_malloced = 0; + realfilename = fs_get(MAXPATH+1); + if(realfilename != NULL){ + if(realpath(filename, realfilename) == NULL) + fs_give((void **) &realfilename); + realfilename_malloced = realfilename != NULL ? 1 : 0; } else - goto io_err; + realfilename_malloced = 0; + if (realfilename_malloced == 0){ + if(our_stat(filename, &sbuf) < 0 && errno == ENOENT){ + realfilename = filename; + realfilename_malloced = 0; + } + else + goto io_err; + } #else realfilename = filename; realfilename_malloced = 0; @@ -5990,7 +5998,7 @@ write_pinerc(struct pine *ps, EditWhich which, int flags) file_attrib_copy(tmp, realfilename); r = rename_file(tmp, realfilename); if(realfilename_malloced != 0) - free((void *)realfilename); + fs_give((void **) &realfilename); if(r < 0) goto io_err; } } diff --git a/pith/pine.hlp b/pith/pine.hlp index 486129cd..802c5544 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 298 2018-07-10 17:38:37 +Alpine Commit 299 2018-08-12 11:48:38 ============= h_news ================= @@ -220,6 +220,10 @@ Bugs that have been addressed include: is used. Revert to using code for the Windows operating system. Reported by Andrew Ho. +
  • The call realpath(..., NULL) gives an error in Solaris, which means that + we need to allocate memory for storing the resolved path. Reported by + Fabian Schmidt. +
  • Crash when attempting to bounce a message due to lack of space in allocated space for key menu array. Reported by David Sewell. -- cgit v1.2.3-70-g09d2