summaryrefslogtreecommitdiffstats
path: root/gl/getdtablesize.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-03-26 12:53:53 +0100
committerGitHub <noreply@github.com>2026-03-26 12:53:53 +0100
commit13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch)
tree3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/getdtablesize.c
parent9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff)
downloadmonitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz
Update/gnulib 2026 03 (#2247)
* Sync with the 202601-stable Gnulib code (4a3650d887) * Ignore more deps stuff in gnulib * Remove autogenerated gnulib files * Ignore more gnulib generated headers
Diffstat (limited to 'gl/getdtablesize.c')
-rw-r--r--gl/getdtablesize.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gl/getdtablesize.c b/gl/getdtablesize.c
index b98fbb70..cc823952 100644
--- a/gl/getdtablesize.c
+++ b/gl/getdtablesize.c
@@ -1,5 +1,5 @@
1/* getdtablesize() function: Return maximum possible file descriptor value + 1. 1/* getdtablesize() function: Return maximum possible file descriptor value + 1.
2 Copyright (C) 2008-2025 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -61,13 +61,10 @@ getdtablesize (void)
61 { 61 {
62 /* We are looking for the number N such that the valid file descriptors 62 /* We are looking for the number N such that the valid file descriptors
63 are 0..N-1. It can be obtained through a loop as follows: 63 are 0..N-1. It can be obtained through a loop as follows:
64 { 64 for (int fd = 3; fd < 65536; fd++)
65 int fd; 65 if (dup2 (0, fd) == -1)
66 for (fd = 3; fd < 65536; fd++) 66 break;
67 if (dup2 (0, fd) == -1) 67 return fd;
68 break;
69 return fd;
70 }
71 On Windows XP, the result is 2048. 68 On Windows XP, the result is 2048.
72 The drawback of this loop is that it allocates memory for a libc 69 The drawback of this loop is that it allocates memory for a libc
73 internal array that is never freed. 70 internal array that is never freed.