diff options
author | Eduardo Chappa <chappa@washington.edu> | 2018-08-12 11:48:52 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2018-08-12 11:48:52 -0600 |
commit | abcd5fe37b31b2e13907893f70a9e411dcf5e295 (patch) | |
tree | 6bc093b14be33feb92f86bb65830804594c4011e /pith | |
parent | 7f7ec82c7dc023b9ac7b985d1abe10e7bd3d908e (diff) | |
download | alpine-abcd5fe37b31b2e13907893f70a9e411dcf5e295.tar.xz |
* 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.
Diffstat (limited to 'pith')
-rw-r--r-- | pith/conf.c | 22 | ||||
-rw-r--r-- | 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 ================= <HTML> <HEAD> @@ -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. + <LI> 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. + <LI> Crash when attempting to bounce a message due to lack of space in allocated space for key menu array. Reported by David Sewell. |