distorted-utils: Currently disabled.
[termux-packages] / packages / newsboat / src-fslock.cpp.patch
CommitLineData
35339209
FF
1diff -u -r ../newsboat-2.10.2/src/fslock.cpp ./src/fslock.cpp
2--- ../newsboat-2.10.2/src/fslock.cpp 2017-12-25 18:49:35.000000000 +0100
3+++ ./src/fslock.cpp 2017-12-26 23:47:20.520356104 +0100
4@@ -5,6 +5,10 @@
5 #include <fcntl.h>
6 #include <string.h>
7
8+#ifdef __ANDROID__
9+#include <sys/file.h>
10+#endif
11+
12 #include <logger.h>
13
14 namespace newsboat {
15@@ -40,7 +44,11 @@
16 }
17
18 // then we lock it (returns immediately if locking is not possible)
19+#ifdef __ANDROID__
20+ if (flock(fd, LOCK_EX) == 0) {
21+#else
22 if (lockf(fd, F_TLOCK, 0) == 0) {
23+#endif
24 LOG(level::DEBUG, "FSLock: locked `%s', writing PID...", new_lock_filepath);
25 std::string pidtext = std::to_string(getpid());
26 // locking successful -> truncate file and write own PID into it