]> ruderich.org/simon Gitweb - coloredstderr/coloredstderr.git/log
coloredstderr/coloredstderr.git
11 years agoMinor documentation updates.
Simon Ruderich [Thu, 13 Jun 2013 20:15:09 +0000 (22:15 +0200)]
Minor documentation updates.

11 years agoAdd missing const and document where it can't be used.
Simon Ruderich [Thu, 13 Jun 2013 20:13:16 +0000 (22:13 +0200)]
Add missing const and document where it can't be used.

11 years agotests/lib.sh: Minor cleanup.
Simon Ruderich [Thu, 13 Jun 2013 20:11:15 +0000 (22:11 +0200)]
tests/lib.sh: Minor cleanup.

11 years agoFix possible memory overwrite in init_from_environment().
Simon Ruderich [Thu, 13 Jun 2013 20:08:08 +0000 (22:08 +0200)]
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.

11 years agoAdd more error checks.
Simon Ruderich [Thu, 13 Jun 2013 19:56:50 +0000 (21:56 +0200)]
Add more error checks.

11 years agoRemove unnecessary calls to update_environment() in exec*().
Simon Ruderich [Thu, 13 Jun 2013 19:50:51 +0000 (21:50 +0200)]
Remove unnecessary calls to update_environment() in exec*().

11 years agoconstants.h: Fix indentation.
Simon Ruderich [Thu, 13 Jun 2013 19:45:19 +0000 (21:45 +0200)]
constants.h: Fix indentation.

11 years agoldpreload.h: Add missing unlikely() in DLSYM_FUNCTION().
Simon Ruderich [Thu, 13 Jun 2013 14:46:48 +0000 (16:46 +0200)]
ldpreload.h: Add missing unlikely() in DLSYM_FUNCTION().

11 years agohookmacros.h: Remove duplication in _HOOK_PRE_FD_/_HOOK_PRE_FILE.
Simon Ruderich [Thu, 13 Jun 2013 14:35:55 +0000 (16:35 +0200)]
hookmacros.h: Remove duplication in _HOOK_PRE_FD_/_HOOK_PRE_FILE.

11 years agotrackfds.h: Add missing inline for consistency.
Simon Ruderich [Thu, 13 Jun 2013 19:34:29 +0000 (21:34 +0200)]
trackfds.h: Add missing inline for consistency.

11 years agoAdd assert()s.
Simon Ruderich [Thu, 13 Jun 2013 19:33:27 +0000 (21:33 +0200)]
Add assert()s.

11 years agoHandle invalid arguments to close()/fclose() better.
Simon Ruderich [Thu, 13 Jun 2013 19:19:15 +0000 (21:19 +0200)]
Handle invalid arguments to close()/fclose() better.

11 years agoFix hook for putc_unlocked() with glibc.
Simon Ruderich [Thu, 13 Jun 2013 10:59:12 +0000 (12:59 +0200)]
Fix hook for putc_unlocked() with glibc.

putc_unlocked() is a macro which expands to __overflow() in some cases.

11 years agotests/test_symbols.sh: Add.
Simon Ruderich [Thu, 13 Jun 2013 00:32:27 +0000 (02:32 +0200)]
tests/test_symbols.sh: Add.

11 years agotests/Makefile.am: Sort dist_check_DATA.
Simon Ruderich [Thu, 13 Jun 2013 00:29:55 +0000 (02:29 +0200)]
tests/Makefile.am: Sort dist_check_DATA.

11 years agoconfigure.ac: fcntl.h is required.
Simon Ruderich [Thu, 13 Jun 2013 00:25:58 +0000 (02:25 +0200)]
configure.ac: fcntl.h is required.

11 years agohookmacros.h: Minor style fix.
Simon Ruderich [Wed, 12 Jun 2013 23:27:45 +0000 (01:27 +0200)]
hookmacros.h: Minor style fix.

11 years agotests: Split run.sh in multiple test files.
Simon Ruderich [Wed, 12 Jun 2013 23:26:25 +0000 (01:26 +0200)]
tests: Split run.sh in multiple test files.

Allows parallel test runs and simplifies optional tests.

11 years agotests: Rename example-* to example_* for consistency.
Simon Ruderich [Wed, 12 Jun 2013 23:05:06 +0000 (01:05 +0200)]
tests: Rename example-* to example_* for consistency.

11 years agotests: Fix tests when running under coloredstderr.
Simon Ruderich [Mon, 10 Jun 2013 20:49:58 +0000 (22:49 +0200)]
tests: Fix tests when running under coloredstderr.

11 years agoREADME: Add.
Simon Ruderich [Mon, 10 Jun 2013 20:33:59 +0000 (22:33 +0200)]
README: Add.

11 years agoAdd another debug() print to init_from_environment().
Simon Ruderich [Mon, 10 Jun 2013 20:25:31 +0000 (22:25 +0200)]
Add another debug() print to init_from_environment().

11 years agoFix compilation with clang.
Simon Ruderich [Mon, 10 Jun 2013 19:27:12 +0000 (21:27 +0200)]
Fix compilation with clang.

11 years agom4/ax_c___attribute__.m4: Add.
Simon Ruderich [Mon, 10 Jun 2013 15:17:21 +0000 (17:17 +0200)]
m4/ax_c___attribute__.m4: Add.

Forgotten in 0a2617527c9b46a587a8f34571a54347cd5c4b5a. Used in
configure.ac.

11 years agoHook execvpe(), a GNU extension.
Simon Ruderich [Mon, 10 Jun 2013 15:10:44 +0000 (17:10 +0200)]
Hook execvpe(), a GNU extension.

11 years agocoloredstderr.c: Fix parameter name in execvp().
Simon Ruderich [Mon, 10 Jun 2013 14:58:27 +0000 (16:58 +0200)]
coloredstderr.c: Fix parameter name in execvp().

11 years agocoloredstderr.c: Fix indentation.
Simon Ruderich [Mon, 10 Jun 2013 14:55:25 +0000 (16:55 +0200)]
coloredstderr.c: Fix indentation.

11 years agoconfigure.ac: Abort if a required function wasn't found.
Simon Ruderich [Mon, 10 Jun 2013 14:54:42 +0000 (16:54 +0200)]
configure.ac: Abort if a required function wasn't found.

11 years agoconfigure.ac: strdup() is no longer used, dup2() is optional.
Simon Ruderich [Mon, 10 Jun 2013 14:54:11 +0000 (16:54 +0200)]
configure.ac: strdup() is no longer used, dup2() is optional.

11 years agoconfigure.ac: Minor style fix.
Simon Ruderich [Mon, 10 Jun 2013 14:22:09 +0000 (16:22 +0200)]
configure.ac: Minor style fix.

11 years agoconfigure.ac: Add --enable-warnings.
Simon Ruderich [Mon, 10 Jun 2013 14:18:35 +0000 (16:18 +0200)]
configure.ac: Add --enable-warnings.

Enables warning() messages without the overhead of all debug output.

11 years agotests: Fix warnings about unused parameters.
Simon Ruderich [Mon, 10 Jun 2013 13:22:17 +0000 (15:22 +0200)]
tests: Fix warnings about unused parameters.

11 years agoOnly run vfork() tests if it's available.
Simon Ruderich [Mon, 10 Jun 2013 13:16:21 +0000 (15:16 +0200)]
Only run vfork() tests if it's available.

11 years agoRename __noinline/__always_inline to prevent clash with headers.
Simon Ruderich [Mon, 10 Jun 2013 12:55:13 +0000 (14:55 +0200)]
Rename __noinline/__always_inline to prevent clash with headers.

With this change noinline can be used in ldpreload.h.

11 years agoPrevent inlining for more functions.
Simon Ruderich [Mon, 10 Jun 2013 12:11:04 +0000 (14:11 +0200)]
Prevent inlining for more functions.

Clang is inlining quite aggressively.

11 years agoPrevent inlining of handle_*_pre/post() functions.
Simon Ruderich [Mon, 10 Jun 2013 04:27:18 +0000 (06:27 +0200)]
Prevent inlining of handle_*_pre/post() functions.

11 years agoDon't mark init_pre_post_string() as inline.
Simon Ruderich [Mon, 10 Jun 2013 04:25:05 +0000 (06:25 +0200)]
Don't mark init_pre_post_string() as inline.

11 years agoFix save/restore of errno for isatty().
Simon Ruderich [Mon, 10 Jun 2013 04:19:00 +0000 (06:19 +0200)]
Fix save/restore of errno for isatty().

11 years agoInline fast part of tracked_fds_find().
Simon Ruderich [Mon, 10 Jun 2013 04:08:35 +0000 (06:08 +0200)]
Inline fast part of tracked_fds_find().

11 years agoUse likely()/unlikely() macros to improve branch prediction.
Simon Ruderich [Mon, 10 Jun 2013 04:06:00 +0000 (06:06 +0200)]
Use likely()/unlikely() macros to improve branch prediction.

11 years agoInline check_handle_fd() into hook macros.
Simon Ruderich [Mon, 10 Jun 2013 03:55:51 +0000 (05:55 +0200)]
Inline check_handle_fd() into hook macros.

It's very small and prologue/epilogue have a lot of overhead.

11 years agoconfigure.ac: Compile with -Wall -Wextra -Wconversion.
Simon Ruderich [Mon, 10 Jun 2013 03:47:04 +0000 (05:47 +0200)]
configure.ac: Compile with -Wall -Wextra -Wconversion.

11 years agoldpreload.h: Split macro into function and macro.
Simon Ruderich [Mon, 10 Jun 2013 03:43:31 +0000 (05:43 +0200)]
ldpreload.h: Split macro into function and macro.

11 years agoRemove errno save/restore where not necessary.
Simon Ruderich [Mon, 10 Jun 2013 03:24:43 +0000 (05:24 +0200)]
Remove errno save/restore where not necessary.

11 years agohandle_*_pre(),handle_*_post(): Remove unused action parameter.
Simon Ruderich [Mon, 10 Jun 2013 02:53:30 +0000 (04:53 +0200)]
handle_*_pre(),handle_*_post(): Remove unused action parameter.

11 years agoconstants.h: Use "\033" instead of the non-standard "\e".
Simon Ruderich [Sun, 9 Jun 2013 14:26:36 +0000 (16:26 +0200)]
constants.h: Use "\033" instead of the non-standard "\e".

11 years agoRemove unused hook puts_unlocked().
Simon Ruderich [Fri, 7 Jun 2013 00:06:57 +0000 (02:06 +0200)]
Remove unused hook puts_unlocked().

This function doesn't exist (yet).

11 years agoFix a few strict compiler warnings.
Simon Ruderich [Fri, 7 Jun 2013 00:01:23 +0000 (02:01 +0200)]
Fix a few strict compiler warnings.

11 years agotrackfds.h: Remove incorrect debug output.
Simon Ruderich [Thu, 6 Jun 2013 23:59:27 +0000 (01:59 +0200)]
trackfds.h: Remove incorrect debug output.

11 years agoUse char const * instead of const char *.
Simon Ruderich [Thu, 6 Jun 2013 23:56:02 +0000 (01:56 +0200)]
Use char const * instead of const char *.

char const * is more consistent with char * const.

11 years agoUse static list of descriptors to reduce mallocs.
Simon Ruderich [Thu, 6 Jun 2013 23:27:58 +0000 (01:27 +0200)]
Use static list of descriptors to reduce mallocs.

Only if file descriptors with a value > 255 occur, the list
implementation is used.

11 years agotests: Run tests under valgrind if it's available.
Simon Ruderich [Thu, 6 Jun 2013 23:17:42 +0000 (01:17 +0200)]
tests: Run tests under valgrind if it's available.

11 years agoAdd warning() and use it in DEBUG mode.
Simon Ruderich [Thu, 6 Jun 2013 22:58:16 +0000 (00:58 +0200)]
Add warning() and use it in DEBUG mode.

11 years agoRename tracked_fds_* tracked_fds_list_*.
Simon Ruderich [Thu, 6 Jun 2013 18:44:10 +0000 (20:44 +0200)]
Rename tracked_fds_* tracked_fds_list_*.

11 years agodebug.h: Minor code style fix.
Simon Ruderich [Thu, 6 Jun 2013 18:13:04 +0000 (20:13 +0200)]
debug.h: Minor code style fix.

11 years agoHook error() and error_at_line() if available.
Simon Ruderich [Wed, 5 Jun 2013 21:57:05 +0000 (23:57 +0200)]
Hook error() and error_at_line() if available.

They are used by some GNU programs to display error messages.

11 years agocoloredstderr.c: Use #include <config.h>.
Simon Ruderich [Wed, 5 Jun 2013 16:11:33 +0000 (18:11 +0200)]
coloredstderr.c: Use #include <config.h>.

This ensures that config.h from the build directory is preferred over a
possible file of the same name in the source directory.

11 years agocheck_handle_fd(): Reduce calls to isatty().
Simon Ruderich [Wed, 5 Jun 2013 01:33:08 +0000 (03:33 +0200)]
check_handle_fd(): Reduce calls to isatty().

11 years agotrackfds.h: Remove unnecessary strdup().
Simon Ruderich [Wed, 5 Jun 2013 01:16:59 +0000 (03:16 +0200)]
trackfds.h: Remove unnecessary strdup().

11 years agoHook execve() and the other exec*() functions.
Simon Ruderich [Tue, 4 Jun 2013 23:40:56 +0000 (01:40 +0200)]
Hook execve() and the other exec*() functions.

Prevents programs from removing our environment variables during the
exec.

Also reduces unnecessary calls to update_environment() by calling it
only once before the exec.

11 years agoMinor documentation updates.
Simon Ruderich [Tue, 4 Jun 2013 23:07:47 +0000 (01:07 +0200)]
Minor documentation updates.

11 years agotests: Also run tests in subshell with LD_PRELOAD set.
Simon Ruderich [Tue, 4 Jun 2013 23:06:10 +0000 (01:06 +0200)]
tests: Also run tests in subshell with LD_PRELOAD set.

11 years agotrackfds.h: Fix realloc() in update_environment().
Simon Ruderich [Tue, 4 Jun 2013 22:57:26 +0000 (00:57 +0200)]
trackfds.h: Fix realloc() in update_environment().

11 years agoImprove debug output.
Simon Ruderich [Tue, 4 Jun 2013 22:53:55 +0000 (00:53 +0200)]
Improve debug output.

11 years agotrackfds.h: Fix invalid write if tracked_fds_count is 0.
Simon Ruderich [Tue, 4 Jun 2013 01:34:19 +0000 (03:34 +0200)]
trackfds.h: Fix invalid write if tracked_fds_count is 0.

Also fixes missing initialization of env array.

11 years agoconfigure.ac: Don't require special versions of malloc/realloc.
Simon Ruderich [Mon, 3 Jun 2013 20:35:51 +0000 (22:35 +0200)]
configure.ac: Don't require special versions of malloc/realloc.

11 years agoconfigure.ac: Reorder macros to follow convention.
Simon Ruderich [Mon, 3 Jun 2013 20:18:16 +0000 (22:18 +0200)]
configure.ac: Reorder macros to follow convention.

11 years agoOnly hook vfork() if it's available.
Simon Ruderich [Mon, 3 Jun 2013 19:59:57 +0000 (21:59 +0200)]
Only hook vfork() if it's available.

11 years agodebug.h: Handle overflow in debug().
Simon Ruderich [Mon, 3 Jun 2013 02:32:12 +0000 (04:32 +0200)]
debug.h: Handle overflow in debug().

11 years agotrackfds.h: Handle overflow in update_environment().
Simon Ruderich [Mon, 3 Jun 2013 02:28:43 +0000 (04:28 +0200)]
trackfds.h: Handle overflow in update_environment().

11 years agotests: Use <STDERR< and >STDERR> as markers.
Simon Ruderich [Sun, 2 Jun 2013 21:41:31 +0000 (23:41 +0200)]
tests: Use <STDERR< and >STDERR> as markers.

Increases contrast to "stderr" output string.

11 years agotests: Use bash to get consistent test results.
Simon Ruderich [Sun, 2 Jun 2013 21:39:14 +0000 (23:39 +0200)]
tests: Use bash to get consistent test results.

11 years agoCOPYING: Add, GPL 3.
Simon Ruderich [Sun, 2 Jun 2013 16:40:39 +0000 (18:40 +0200)]
COPYING: Add, GPL 3.

11 years agoHook vfork() and replace it with fork().
Simon Ruderich [Sun, 2 Jun 2013 16:25:49 +0000 (18:25 +0200)]
Hook vfork() and replace it with fork().

11 years agohookmacros.h: Be more careful to restore the errno.
Simon Ruderich [Sat, 1 Jun 2013 20:47:23 +0000 (22:47 +0200)]
hookmacros.h: Be more careful to restore the errno.

check_handle_fd() or handle_fd_pre() might also modify it.

11 years agohookmacros.h: Reduce duplication in HOOK_VOID1().
Simon Ruderich [Sat, 1 Jun 2013 20:44:22 +0000 (22:44 +0200)]
hookmacros.h: Reduce duplication in HOOK_VOID1().

11 years agoHook perror(3).
Simon Ruderich [Sat, 1 Jun 2013 20:08:45 +0000 (22:08 +0200)]
Hook perror(3).

11 years agoconfigure.ac: Require libtool 2.4.
Simon Ruderich [Sat, 1 Jun 2013 19:55:10 +0000 (21:55 +0200)]
configure.ac: Require libtool 2.4.

11 years agoAdd simple test suite.
Simon Ruderich [Sat, 1 Jun 2013 19:51:28 +0000 (21:51 +0200)]
Add simple test suite.

11 years agoAdd ENV_NAME_FORCE_WRITE to force writes to non-tty devices.
Simon Ruderich [Sat, 1 Jun 2013 19:13:23 +0000 (21:13 +0200)]
Add ENV_NAME_FORCE_WRITE to force writes to non-tty devices.

11 years agoFix initialization if ENV_NAME_FDS was not set.
Simon Ruderich [Sat, 1 Jun 2013 16:27:56 +0000 (18:27 +0200)]
Fix initialization if ENV_NAME_FDS was not set.

If ENV_NAME_FDS is not set then init_from_environment() was called for
each hooked function, instead of just once.

11 years agoFix signature of fcntl() hook.
Simon Ruderich [Fri, 31 May 2013 20:31:11 +0000 (22:31 +0200)]
Fix signature of fcntl() hook.

11 years agoDisplay PID in tracked_fds_debug().
Simon Ruderich [Fri, 31 May 2013 16:40:49 +0000 (18:40 +0200)]
Display PID in tracked_fds_debug().

11 years agotrackfds.h: Add missing void to function definition.
Simon Ruderich [Fri, 31 May 2013 16:39:47 +0000 (18:39 +0200)]
trackfds.h: Add missing void to function definition.

11 years agofcntl(): Don't call dup_fd() if real_fcntl() failed.
Simon Ruderich [Fri, 31 May 2013 16:37:55 +0000 (18:37 +0200)]
fcntl(): Don't call dup_fd() if real_fcntl() failed.

11 years agoRename macros.h to hookmacros.h.
Simon Ruderich [Fri, 31 May 2013 16:36:21 +0000 (18:36 +0200)]
Rename macros.h to hookmacros.h.

11 years agoInitial commit.
Simon Ruderich [Fri, 31 May 2013 16:19:12 +0000 (18:19 +0200)]
Initial commit.