summaryrefslogtreecommitdiff
path: root/pith/readfile.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-10-05 01:10:52 -0600
committerEduardo Chappa <chappa@washington.edu>2016-10-05 01:10:52 -0600
commit4f2c1e32cfe0ebcb628c5a55a52eef283aa39446 (patch)
tree31327e907a51c422e05f91f827bd1b166ce988d5 /pith/readfile.c
parent174c8ccf0d4aae97fc5858d082c58fd5b23402a0 (diff)
downloadalpine-4f2c1e32cfe0ebcb628c5a55a52eef283aa39446.tar.xz
* When Alpine is compiled with password file and SMIME support
the password file is encrypted using a private key/public certificate pair. If one such pair cannot be found, one will be created.
Diffstat (limited to 'pith/readfile.c')
-rw-r--r--pith/readfile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pith/readfile.c b/pith/readfile.c
index cae03fc1..e918ec99 100644
--- a/pith/readfile.c
+++ b/pith/readfile.c
@@ -78,6 +78,7 @@ our_copy(char *to_file, char *from_file)
{
STORE_S *in_cert, *out_cert;
unsigned char c;
+ long int size = 0;
in_cert = so_get(FileStar, from_file, READ_ACCESS | READ_FROM_LOCALE);
if (in_cert == NULL)
@@ -89,9 +90,14 @@ our_copy(char *to_file, char *from_file)
return -1;
}
- while(so_readc(&c, in_cert) > 0)
- so_writec(c, out_cert);
+ so_seek(out_cert, 0L, 0);
+ so_truncate(out_cert, 0);
+ while(so_readc(&c, in_cert) > 0){
+ so_writec(c, out_cert);
+// size++;
+ }
+// so_truncate(out_cert, size);
so_give(&in_cert);
so_give(&out_cert);