Simon Ruderich
2fc66e15eb
Improve checks for invalid file descriptors.
...
Just in case a real dup*() or fcntl() doesn't return -1 on error, but
something like -2.
2013-06-21 23:03:12 +02:00
Simon Ruderich
219a9882ba
tests: Check return values of write() and dup2().
2013-06-21 23:03:12 +02:00
Simon Ruderich
0d7f306898
Overwrite tracked file descriptors when exporting COLORED_STDERR_FDS.
...
If the list of tracked file descriptors is modified to contain unwanted
values (e.g. when a parent process closes or redirects stderr), this
makes it possible to set the tracked file descriptors back to a given
list.
This problem occurred with startx which somehow closes or redirects
stderr. As COLORED_STDERR_FDS was set in the shell running startx, this
disabled coloring stderr for all processes started in the X11 session.
This is no longer an issue. As COLORED_STDERR_FDS is set in the shell
configuration file, it automatically sets the list to the correct value
when a shell is opened in the terminal emulator once X11 is running.
2013-06-21 23:03:12 +02:00
Simon Ruderich
045ca46e79
Hook __swbuf() on FreeBSD.
...
Coloring works fine now on FreeBSD (with some minor issues). Tests still
fail though.
2013-06-20 23:33:27 +02:00
Simon Ruderich
ba2283bd37
Remove invalid assert() in tracked_fds_find().
2013-06-20 23:17:03 +02:00
Simon Ruderich
f3c734eb7d
configure.ac: Check if __overflow() is available.
2013-06-20 22:14:42 +02:00
Simon Ruderich
b0c02291be
Hook __overflow() correctly.
...
It takes a FILE * and must be hooked with HOOK_FILE*().
2013-06-20 22:13:04 +02:00
Simon Ruderich
d78910e363
tests/Makefile.am: Remove unnecessary *_SOURCES variables.
...
They are only required if more than one source file (or one with a
different name) is used.
2013-06-20 22:02:30 +02:00
Simon Ruderich
4eb55ac071
{fwrite,fputs,fputc}_unlocked() are not in POSIX.
...
Define fwrite_unlocked(), fputs_unlocked() and fputc_unlocked() only if
they are available on the system.
2013-06-20 20:56:51 +02:00
Simon Ruderich
1fb32dbd84
tests: Remove test_symbols.sh.
...
It's useless as different systems provide/require different symbols.
Will be replaced by a better test.
2013-06-20 20:46:06 +02:00
Simon Ruderich
cfad8a624c
Update documentation.
2013-06-18 00:07:03 +02:00
Simon Ruderich
85699d0263
tests/example.c: Use errno = ENOMEM.
...
The output from errno = 0 is less portable.
2013-06-17 23:28:07 +02:00
Simon Ruderich
a63fef43c2
Add missing #include <sys/stat.h>.
2013-06-17 23:26:00 +02:00
Simon Ruderich
50a495887f
README: setuid binaries are not supported.
2013-06-15 16:53:47 +02:00
Simon Ruderich
34b3b93136
tests/example_error.c: Fix typo in function name.
2013-06-15 03:41:06 +02:00
Simon Ruderich
a58d1a9017
Mark hooked functions as visibility(("protected")).
2013-06-15 03:36:50 +02:00
Simon Ruderich
ca12529c8f
hookmacros.h: Reduce duplication in macros.
...
Also preparation to add attributes to function declarations.
2013-06-15 03:23:53 +02:00
Simon Ruderich
941370dda9
Hook BSD err(), errx(), warn(), warnx(), etc. functions.
...
err(), errx(), warn(), warnx(), verr(), verrx(), vwarn(), vwarnx() are
hooked.
2013-06-15 02:39:52 +02:00
Simon Ruderich
1068648718
Minor documentation update.
2013-06-15 02:21:27 +02:00
Simon Ruderich
0a909cac79
Use locally defined functions in hooks where possible.
...
Don't create a hook and call the "real" function when it's enough to
call an existing hook for this function.
2013-06-15 01:58:36 +02:00
Simon Ruderich
217e8c8bc5
Define real_*() static variables with macros.
2013-06-15 00:54:46 +02:00
Simon Ruderich
9507e0f60d
configure.ac: Fix Vim's syntax coloring issue with `..'.
2013-06-14 21:24:53 +02:00
Simon Ruderich
6ae629bef0
tests/Makefile.am: Enable parallel and colored test runs.
...
Necessary for automake < 1.13.
2013-06-14 21:24:53 +02:00
Simon Ruderich
18d52b3b5a
Install libcoloredstderr.so read-only.
...
Prevents accidental truncates of libcoloredstderr.so with `cp` which
crash all programs which have loaded it.
2013-06-14 13:40:06 +02:00
Simon Ruderich
dcaadb5f7c
README: Explain how to modify pre/post variables.
2013-06-14 12:44:34 +02:00
Simon Ruderich
04334418fc
README: Add first part of installation instructions.
2013-06-14 11:07:40 +02:00
Simon Ruderich
208757de88
.gitignore: Ignore generated test files.
...
Forgotten in d8be625da9 and
59375c2b79 .
2013-06-13 22:43:43 +02:00
Simon Ruderich
d5b84811d2
tests/lib.sh: Fix tests for dash.
2013-06-13 22:35:42 +02:00
Simon Ruderich
1d1b6d7769
Remove duplicate code in init_from_environment().
2013-06-13 22:15:49 +02:00
Simon Ruderich
45d25526c0
Minor documentation updates.
2013-06-13 22:15:09 +02:00
Simon Ruderich
3d46e3ab9b
Add missing const and document where it can't be used.
2013-06-13 22:13:16 +02:00
Simon Ruderich
3c2b4bf9f6
tests/lib.sh: Minor cleanup.
2013-06-13 22:11:15 +02:00
Simon Ruderich
59375c2b79
Fix possible memory overwrite in init_from_environment().
...
It was possible for a user to overwrite memory at a relative location
with 1 by passing a negative file descriptor.
2013-06-13 22:08:08 +02:00
Simon Ruderich
f30dbbd26d
Add more error checks.
2013-06-13 21:56:50 +02:00
Simon Ruderich
e5a94fa847
Remove unnecessary calls to update_environment() in exec*().
2013-06-13 21:50:51 +02:00
Simon Ruderich
1e02760898
constants.h: Fix indentation.
2013-06-13 21:45:19 +02:00
Simon Ruderich
7eb1667d41
ldpreload.h: Add missing unlikely() in DLSYM_FUNCTION().
2013-06-13 21:44:55 +02:00
Simon Ruderich
0ad5e4db04
hookmacros.h: Remove duplication in _HOOK_PRE_FD_/_HOOK_PRE_FILE.
2013-06-13 21:44:55 +02:00
Simon Ruderich
d171e6bbec
trackfds.h: Add missing inline for consistency.
2013-06-13 21:34:29 +02:00
Simon Ruderich
6d6ad4423a
Add assert()s.
2013-06-13 21:33:27 +02:00
Simon Ruderich
37cb5686de
Handle invalid arguments to close()/fclose() better.
2013-06-13 21:19:15 +02:00
Simon Ruderich
7adfbfd2cf
Fix hook for putc_unlocked() with glibc.
...
putc_unlocked() is a macro which expands to __overflow() in some cases.
2013-06-13 12:59:12 +02:00
Simon Ruderich
d8be625da9
tests/test_symbols.sh: Add.
2013-06-13 02:32:27 +02:00
Simon Ruderich
5e8be10581
tests/Makefile.am: Sort dist_check_DATA.
2013-06-13 02:29:55 +02:00
Simon Ruderich
e954d0fdfd
configure.ac: fcntl.h is required.
2013-06-13 02:25:58 +02:00
Simon Ruderich
52b4e91146
hookmacros.h: Minor style fix.
2013-06-13 01:27:45 +02:00
Simon Ruderich
04ac66863a
tests: Split run.sh in multiple test files.
...
Allows parallel test runs and simplifies optional tests.
2013-06-13 01:26:25 +02:00
Simon Ruderich
05aefe25ba
tests: Rename example-* to example_* for consistency.
2013-06-13 01:05:06 +02:00
Simon Ruderich
8a58e07a5b
tests: Fix tests when running under coloredstderr.
2013-06-10 22:49:58 +02:00
Simon Ruderich
b24bd8dc43
README: Add.
2013-06-10 22:33:59 +02:00