[PATCH FOR REVIEW] rc.subr: use stderr instead of stdout for trap
handlers
Xin Li
delphij at delphij.net
Thu Feb 16 01:10:11 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
Currently if certain signals is received, rc.subr's trap instruction
would inject output to standard output. This could be a problem if
the script uses standard output for other purposes, e.g. generating a
configuration file, etc.
The proposed change redirects these information to standard error.
Objections?
Cheers,
- --
Xin LI <delphij at delphij.net> https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)
iQEcBAEBCAAGBQJPPFdxAAoJEG80Jeu8UPuzyksH/jZH6o5C3jBSarSSElKyU42A
k1Wrz7GUdp36cQBIGHw0dZsEOZmMS5r6IghztLPZwO4H+1yJEae4tvkUJK2V+6t5
yBptnyzYbtAr0ns4/ntnfNJgk8NyQER4F0U5txzQgIAHhrhNPSJUr5assziU1AaN
VjOpKyysBcd5btLwLfLwVwcZrwListL8YdN1CrRN2LAHY+Y9dFOYeqeIWp2vVA61
o7aegzN9hk2zr4byuoA+cyyqqWCmw4xcSEPYB3nXU3GPwGsCpp0vlXtjUIBGeGnJ
+ooI+MfBVyVxnR3PJR4hleq2BiBEYtGzYt2aXd9lHGMBA/ZJL1m3t7GpvwIfCDA=
=Vmmg
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: etc/rc.subr
===================================================================
--- etc/rc.subr (revision 231173)
+++ etc/rc.subr (working copy)
@@ -978,9 +978,9 @@
if [ -n "$rc_fast_and_loose" ]; then
set $_arg; . $_file
else
- ( trap "echo Script $_file interrupted; kill -QUIT $$" 3
- trap "echo Script $_file interrupted; exit 1" 2
- trap "echo Script $_file running" 29
+ ( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3
+ trap "echo Script $_file interrupted >&2 ; exit 1" 2
+ trap "echo Script $_file running >&2" 29
set $_arg; . $_file )
fi
fi
More information about the freebsd-rc
mailing list