termux-packages/packages/newsboat/src-fslock.cpp.patch

27 lines
749 B
Diff

diff -u -r ../newsboat-2.10.2/src/fslock.cpp ./src/fslock.cpp
--- ../newsboat-2.10.2/src/fslock.cpp 2017-12-25 18:49:35.000000000 +0100
+++ ./src/fslock.cpp 2017-12-26 23:47:20.520356104 +0100
@@ -5,6 +5,10 @@
#include <fcntl.h>
#include <string.h>
+#ifdef __ANDROID__
+#include <sys/file.h>
+#endif
+
#include <logger.h>
namespace newsboat {
@@ -40,7 +44,11 @@
}
// then we lock it (returns immediately if locking is not possible)
+#ifdef __ANDROID__
+ if (flock(fd, LOCK_EX) == 0) {
+#else
if (lockf(fd, F_TLOCK, 0) == 0) {
+#endif
LOG(level::DEBUG, "FSLock: locked `%s', writing PID...", new_lock_filepath);
std::string pidtext = std::to_string(getpid());
// locking successful -> truncate file and write own PID into it