axel: Add package
[termux-packages] / packages / axel / axel.c.patch
diff --git a/packages/axel/axel.c.patch b/packages/axel/axel.c.patch
new file mode 100644 (file)
index 0000000..decb0d7
--- /dev/null
@@ -0,0 +1,32 @@
+--- axel-2.16.1/src/axel.c     2017-12-05 10:46:05.000000000 +0530
++++ axel.c     2018-03-14 19:29:42.000000000 +0530
+@@ -617,7 +617,7 @@
+                       } else {
+                               if (gettime() > (axel->conn[i].last_transfer +
+                                                axel->conf->reconnect_delay)) {
+-                                      pthread_cancel(*axel->conn[i].setup_thread);
++                                      pthread_kill(*axel->conn[i].setup_thread, 0);
+                                       axel->conn[i].state = false;
+                                       pthread_join(*axel->conn[i].
+                                                    setup_thread, NULL);
+@@ -687,7 +687,7 @@
+       for (int i = 0; i < axel->conf->num_connections; i++) {
+               /* don't try to kill non existing thread */
+               if (*axel->conn[i].setup_thread != 0) {
+-                      pthread_cancel(*axel->conn[i].setup_thread);
++                      pthread_kill(*axel->conn[i].setup_thread, 0);
+                       pthread_join(*axel->conn[i].setup_thread, NULL);
+               }
+               conn_disconnect(&axel->conn[i]);
+@@ -770,9 +770,11 @@
+       int oldstate;
+       /* Allow this thread to be killed at any time. */
++#ifndef __ANDROID__
+       pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
+       pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate);
++#endif
+       pthread_mutex_lock(&conn->lock);
+       if (conn_setup(conn)) {
+               conn->last_transfer = gettime();