termux-packages/packages/lsof/main.c.patch
2022-04-30 16:43:45 +09:00

26 lines
696 B
Diff

--- a/main.c
+++ b/main.c
@@ -123,19 +123,19 @@
* Make sure umask allows lsof to define its own file permissions.
*/
- if ((MaxFd = (int) GET_MAX_FD()) < 53)
+ if ((MaxFd = (int) sysconf(_SC_OPEN_MAX)) < 53)
MaxFd = 53;
#if defined(HAS_CLOSEFROM)
(void) closefrom(3);
#else /* !defined(HAS_CLOSEFROM) */
-#if defined(SYS_close_range)
+#if defined(SYS_close_range) && !defined(__ANDROID__)
if (MaxFd > 3 && syscall(SYS_close_range, 3, MaxFd - 1, 0) == 0)
goto closed;
#endif
for (i = 3; i < MaxFd; i++)
(void) close(i);
-#if defined(SYS_close_range)
+#if defined(SYS_close_range) && !defined(__ANDROID__)
closed:
#endif
#endif /* !defined(HAS_CLOSEFROM) */