termux-packages/packages/dropbear/gensignkey.c.patch

29 lines
830 B
Diff

diff -uNr dropbear-2018.76/gensignkey.c dropbear-2018.76.mod/gensignkey.c
--- dropbear-2018.76/gensignkey.c 2018-02-27 16:25:10.000000000 +0200
+++ dropbear-2018.76.mod/gensignkey.c 2018-04-21 13:45:22.973731479 +0300
@@ -140,6 +140,16 @@
goto out;
}
+#ifdef __ANDROID__
+ /* Hard links are not possible and renam. */
+ if (skip_exist && access(filename, F_OK) == 0) {
+ /* Ok. */
+ } else if (rename(fn_temp, filename) < 0) {
+ dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", filename,
+ strerror(errno));
+ ret = DROPBEAR_FAILURE;
+ }
+#else
if (link(fn_temp, filename) < 0) {
/* If generating keys on connection (skipexist) it's OK to get EEXIST
- we probably just lost a race with another connection to generate the key */
@@ -151,6 +161,7 @@
goto out;
}
}
+#endif
out:
if (buf) {