]> git.plutz.net Git - cgilite/commitdiff
automatically discard stderr when running via inetd master
authorPaul Hänsch <paul@plutz.net>
Wed, 28 Oct 2026 16:46:53 +0000 (17:46 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 28 Oct 2026 16:46:53 +0000 (17:46 +0100)
cgilite.sh

index f261f9c195c12d8cc53d6b374382a0f46b5e855d..0d122608838b29a2756aedc82ac54cc888dc4214 100755 (executable)
@@ -3,7 +3,7 @@
 # This is CGIlite.
 # A collection of posix shell functions for writing CGI scripts.
 
-# Copyright 2017 - 2023, 2025 Paul Hänsch
+# Copyright 2017 - 2023, 2025 - 2026 Paul Hänsch
 # 
 # Permission to use, copy, modify, and/or distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -52,6 +52,11 @@ _DATA="${_DATA:-${PWD:-.}}"
 _EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}"
 # Do not set DEBUG here, because it will increase log level
 
+# discard stderr when running via inetd (relies on undocumented env var?)
+if [ -z "$DEBUG" -a -n "$inetd_dummy" ]; then
+  exec 2>/dev/null
+fi
+
 export _EXEC _DATA _BASE
 
 # Carriage Return and Line Break characters for convenience