summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2020-11-16 20:38:04 +0100
committerChristian Persch <chpe@src.gnome.org>2020-11-16 20:38:04 +0100
commit770a375f023dd7bcd25a45ca01ff1fdcabf4c5bf (patch)
tree3f4d6a637d3e69237caf18d94f0bf5ecda544b28
parentefebf38e278b80ef4670dad87d749898cf244f88 (diff)
downloadvte-770a375f023dd7bcd25a45ca01ff1fdcabf4c5bf.tar.gz
lib: Fix unused variable warning when not using getrlimit
Mentioned in https://gitlab.gnome.org/GNOME/vte/-/issues/296#note_963045
-rw-r--r--src/missing.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/missing.cc b/src/missing.cc
index e6da31e9..214419fc 100644
--- a/src/missing.cc
+++ b/src/missing.cc
@@ -90,16 +90,21 @@ static rlim_t
getrlimit_NOFILE_max(void)
{
#ifdef HAVE_SYS_RESOURCE_H
+#ifdef __linux__
+{
struct rlimit rlim;
-#ifdef __linux__
if (prlimit(0 /* this PID */, RLIMIT_NOFILE, nullptr, &rlim) == 0)
return rlim.rlim_max;
return RLIM_INFINITY;
+}
#endif /* __linux__ */
#ifdef __GLIBC__
+{
+ struct rlimit rlim;
+
/* Use getrlimit() function provided by the system if it is known to be
* async-signal safe.
*
@@ -107,9 +112,10 @@ getrlimit_NOFILE_max(void)
*/
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
return rlim.rlim_max;
+}
/* fallback */
-#endif
+#endif /* __GLIBC__ */
#endif /* HAVE_SYS_RESOURCE_H */