While building prosody I noticed this build warning
x86_64-linux-gnu-gcc -std=c99 -fPIC -std=c99 -Wall -pedantic -Wextra -Wshadow -Wformat=2 -g
-O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=.
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security
-fcf-protection -I/usr/include/lua5.4 -Wdate-time -D_FORTIFY_SOURCE=2 -c -o pposix.o
pposix.c
pposix.c: In function ‘lc_daemonize’:
pposix.c:126:9: warning: ignoring return value of ‘freopen’ declared with
attribute ‘warn_unused_result’ [-Wunused-result]
126 | freopen("/dev/null", "r", stdin);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pposix.c:127:9: warning: ignoring return value of ‘freopen’ declared with
attribute ‘warn_unused_result’ [-Wunused-result]
127 | freopen("/dev/null", "w", stdout);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pposix.c:128:9: warning: ignoring return value of ‘freopen’ declared with
attribute ‘warn_unused_result’ [-Wunused-result]
128 | freopen("/dev/null", "w", stderr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That can be easily be removed with
diff -r 64cd905cb1de util-src/pposix.c
--- a/util-src/pposix.c Thu Jan 22 17:54:30 2026 +0100
+++ b/util-src/pposix.c Fri Jan 30 09:25:25 2026 +0100
@@ -123,9 +123,12 @@
}
/* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ if(!freopen("/dev/null", "r", stdin))
+ fprintf(stderr, "Failed to redirect stdin to /dev/null");
+ if(!freopen("/dev/null", "w", stdout))
+ fprintf(stderr, "Failed to redirect stdout to /dev/null");
+ if(!freopen("/dev/null", "w", stderr))
+ fprintf(stderr, "Failed to redirect stderr to /dev/null");
/* Final fork, use it wisely */
if(fork()) {
--
You received this message because you are subscribed to the Google Groups
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/prosody-dev/3ece93c1-90d7-4598-8515-1c845c112622%40gmail.com.