Prevents accidental truncates of libcoloredstderr.so with `cp` which
crash all programs which have loaded it.
the library. Just remove the file first and then copy it. `make install`
handles the install in this way and is therefore not affected.
+As a simple safeguard, `make` builds and installs the `libcoloredstderr.so`
+file non-writable to prevent accidental overwrites. Even if the overwrite is
+forced with `cp -f`, the file is unlinked and recreated by `cp` because the
+file is non-writable, preventing the problem.
+
USAGE
-----
hookmacros.h \
ldpreload.h \
trackfds.h
+
+# Make sure the library is not writable. See README why this is important. Is
+# not run with `make libcoloredstderr.la`, but this isn't common usage.
+all-local: $(lib_LTLIBRARIES)
+ find .libs -type f -exec chmod ugo-w '{}' \;
+# `install` uses normal permissions, "fix" them so `make install` also
+# installs non-writable files.
+install-exec-hook:
+ find $(DESTDIR)$(libdir) -type f -exec chmod ugo-w '{}' \;