From 62b119e07f29fa8ca6926b1186fa3eb14cb4f481 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Sun, 28 Jul 2019 22:26:55 -0400 Subject: [PATCH] Keep around a copy of the old dropbear.err so that it can be accessed after the server is re-started for a crash (to get easy access to the crash dump). --- jni/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jni/interface.c b/jni/interface.c index dd1b6b1..54583d6 100644 --- a/jni/interface.c +++ b/jni/interface.c @@ -141,11 +141,15 @@ Java_org_galexander_sshd_SimpleSSHDService_start_1sshd(JNIEnv *env_, char *argv[100] = { "sshd", NULL }; int argc = 1; const char *logfn; + const char *logfn_old; int logfd; int retval; int i; logfn = conf_path_file("dropbear.err"); + logfn_old = conf_path_file("dropbear.err.old"); + unlink(logfn_old); + rename(logfn, logfn_old); unlink(logfn); logfd = open(logfn, O_CREAT|O_WRONLY, 0666); if (logfd != -1) {