0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-11 10:55:36 +00:00
Files
termux-packages/x11-packages/qbittorrent/0001-getrandom.patch
2025-04-29 01:26:13 +05:30

25 lines
661 B
Diff

--- a/src/base/utils/randomlayer_linux.cpp
+++ b/src/base/utils/randomlayer_linux.cpp
@@ -34,6 +34,9 @@
#include <QtLogging>
+#include <syscall.h>
+#include <unistd.h>
+
namespace
{
class RandomLayer
@@ -63,7 +66,11 @@ namespace
for (int i = 0; i < RETRY_MAX; ++i)
{
result_type buf = 0;
+#if defined(__ANDROID__) && __ANDROID_API__ < 28
+ const ssize_t result = syscall(__NR_getrandom, &buf, sizeof(buf), 0);
+#else
const ssize_t result = ::getrandom(&buf, sizeof(buf), 0);
+#endif
if (result == sizeof(buf)) // success
return buf;