8e62524280b53441632f14d4666ade32b14acc7b
[termux-packages] / packages / dropbear / gensignkey.c.patch
1 diff -u -r ../dropbear-2017.75/gensignkey.c ./gensignkey.c
2 --- ../dropbear-2017.75/gensignkey.c 2017-05-18 16:47:01.000000000 +0200
3 +++ ./gensignkey.c 2017-06-13 23:50:59.888597482 +0200
4 @@ -137,6 +137,16 @@
5 goto out;
6 }
7
8 +#ifdef __ANDROID__
9 + /* Hard links are not possible and renam. */
10 + if (skip_exist && access(filename, F_OK) == 0) {
11 + /* Ok. */
12 + } else if (rename(fn_temp, filename) < 0) {
13 + dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", filename,
14 + strerror(errno));
15 + ret = DROPBEAR_FAILURE;
16 + }
17 +#else
18 if (link(fn_temp, filename) < 0) {
19 /* If generating keys on connection (skipexist) it's OK to get EEXIST
20 - we probably just lost a race with another connection to generate the key */
21 @@ -148,6 +158,7 @@
22 goto out;
23 }
24 }
25 +#endif
26
27 out:
28 if (buf) {