summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/ratox.c b/ratox.c
index 9c68003..f7034c7 100644
--- a/ratox.c
+++ b/ratox.c
@@ -601,17 +601,21 @@ dataload(void)
exit(EXIT_FAILURE);
}
- if (encryptsave == 1)
- r = tox_encrypted_load(tox, data, sz, passphrase, pplen);
- else
+ if (encryptsave == 1) {
+ while (1) {
+ r = tox_encrypted_load(tox, data, sz, passphrase, pplen);
+ if (r < 0)
+ readpass();
+ else
+ break;
+ }
+ } else {
r = tox_load(tox, data, sz);
- if (r < 0) {
- fprintf(stderr, "%s failed\n",
- encryptsave == 1 ? "tox_encrypted_load" : "tox_load");
- exit(EXIT_FAILURE);
- } else if (r == 1) {
- fprintf(stderr, "Found encrypted %s but encryption is disabled\n",
- DATAFILE);
+ if (r < 0)
+ fprintf(stderr, "tox_load() failed\n");
+ else if (r == 1)
+ fprintf(stderr, "Found encrypted %s but encryption is disabled\n",
+ DATAFILE);
exit(EXIT_FAILURE);
}