summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pith/conf.c64
-rw-r--r--pith/pine.hlp5
2 files changed, 23 insertions, 46 deletions
diff --git a/pith/conf.c b/pith/conf.c
index 4b2dc384..66dc6dbe 100644
--- a/pith/conf.c
+++ b/pith/conf.c
@@ -5936,54 +5936,28 @@ write_pinerc(struct pine *ps, EditWhich which, int flags)
}
if(!(rd && rd->flags & NO_FILE)){
- if(so_give(&so))
- goto io_err;
+ char *realfilename;
+ int realfilename_malloced;
+
+ if(so_give(&so)) goto io_err;
#ifndef _WINDOWS
- /* if .pinerc is a symbolic link, override symbolic link */
- if(our_lstat(filename, &sbuf) == 0
- && ((sbuf.st_mode & S_IFMT) == S_IFLNK)){
- if((slink = fs_get((sbuf.st_size+1)*sizeof(char))) != NULL){
- int r = -1; /* assume error */
- if(readlink(filename, slink, sbuf.st_size + 1) >= 0){
- char *slpath;
-
- slink[sbuf.st_size] = '\0';
- if(*slink == '/')
- slpath = cpystr(slink);
- else{
- char * basep;
- int n;
-
- basep = strrchr(filename, '/');
- if(basep != NULL){
- *basep = '\0';
- n = strlen(filename) + strlen(slink) + 2;
- slpath = (char *) fs_get(n*sizeof(char));
- snprintf(slpath, n, "%s/%s", filename, slink);
- *basep = '/';
- } else {
- n = strlen(ps_global->home_dir) + strlen(slink) + 2;
- slpath = (char *) fs_get(n*sizeof(char));
- snprintf(slpath, n, "%s/%s", ps_global->home_dir, slink);
- }
- slpath[n-1] = '\0';
- }
- file_attrib_copy(tmp, slpath);
- r = rename_file(tmp, slpath);
- fs_give((void **)&slpath);
- }
- fs_give((void **)&slink);
- if (r < 0) goto io_err;
- }
- }
- else
+ if ((realfilename = realpath(filename, NULL)) != NULL)
+ realfilename_malloced = 1;
+ else
+ goto io_err;
+#else
+ realfilename = filename;
+ realfilename_malloced = 0;
#endif /* _WINDOWS */
- {
- file_attrib_copy(tmp, filename);
- if(rename_file(tmp, filename) < 0)
- goto io_err;
- }
+ if(realfilename != NULL){
+ int r;
+ file_attrib_copy(tmp, realfilename);
+ r = rename_file(tmp, realfilename);
+ if(realfilename_malloced != 0)
+ free((void *)realfilename);
+ if(r < 0) goto io_err;
+ }
}
if(prc->type != Loc){
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 9dd808b0..a65ee61b 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 95 2015-09-06 21:11:08
+Alpine Commit 99 2015-09-07 01:55:47
============= h_news =================
<HTML>
<HEAD>
@@ -251,6 +251,9 @@ Additions include:
and ca directories. This is useful in case a user has a backup of
old certificates that cannot be installed in the ~/.alpine-smime
dir.
+
+ <LI> Reimplementation of the code that allows the .pinerc file to be a
+ symbolic link by Kyle George from tcpsoft.com to use realpath.
</UL>