missing: change our close_range() syscall wrapper to map glibc's
So glibc exposes a close_range() syscall wrapper now, but they decided to use "unsigned" as type for the fds. Which is a bit weird, because fds are universally understood to be "int". The kernel internally uses "unsigned", both for close() and for close_range(), but weirdly, userspace didn't fix that for close_range() unlike what they did for close()... Weird. But anyway, let's follow suit, and make our wrapper match glibc's. Fixes #31270
This commit is contained in:
+2
-2
@@ -308,7 +308,7 @@ static int close_all_fds_special_case(const int except[], size_t n_except) {
|
||||
case 0:
|
||||
/* Close everything. Yay! */
|
||||
|
||||
if (close_range(3, -1, 0) >= 0)
|
||||
if (close_range(3, INT_MAX, 0) >= 0)
|
||||
return 1;
|
||||
|
||||
if (ERRNO_IS_NOT_SUPPORTED(errno) || ERRNO_IS_PRIVILEGE(errno)) {
|
||||
@@ -419,7 +419,7 @@ int close_all_fds(const int except[], size_t n_except) {
|
||||
if (sorted[n_sorted-1] >= INT_MAX) /* Dont let the addition below overflow */
|
||||
return 0;
|
||||
|
||||
if (close_range(sorted[n_sorted-1] + 1, -1, 0) >= 0)
|
||||
if (close_range(sorted[n_sorted-1] + 1, INT_MAX, 0) >= 0)
|
||||
return 0;
|
||||
|
||||
if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno))
|
||||
|
||||
Reference in New Issue
Block a user