Some random fixes
* General: Small fixes (indentation, typos, clean-up of code)
* ltrace.c: Close output file on exit
* ltrace.c: use getenf("HOME") instead of getpwuid(geteuid())->pw_dir
* read_config_file.c, display_args.c: remove "ignore" argtype;
that's what "void" is for
* packaging/debian/: misc fixes, sync with version 0.5-1
* etc/ltrace.conf: added more system calls
* testsuite/ltrace.minor/trace-clone.c: sleep(1) to avoid earlier
termination of process
* sysdeps/linux-gnu/trace.c: trace_pid(): reverted Petr's patch
to wait for child to stop, as it stopped following clone()
* process_event.c: Disable breakpoints before doing fork() (again!),
to make children work as expected
diff --git a/ltrace.c b/ltrace.c
index 881ebc1..3c7d661 100644
--- a/ltrace.c
+++ b/ltrace.c
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <pwd.h>
#include <string.h>
#include <errno.h>
#include <sys/param.h>
@@ -37,7 +36,8 @@
if (!tmp) {
return;
}
- break;
+ tmp2 = opt_p;
+ continue;
}
tmp2 = tmp2->next;
}
@@ -51,6 +51,10 @@
{
exiting = 1;
debug(1, "Received interrupt signal; exiting...");
+ if (opt_o) {
+ fclose(output);
+ opt_o = 0;
+ }
signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
signal(SIGALRM, signal_alarm);
@@ -71,6 +75,9 @@
if (opt_c) {
show_summary();
}
+ if (opt_o) {
+ fclose(output);
+ }
}
static void guess_cols(void)
@@ -102,24 +109,24 @@
guess_cols();
argv = process_options(argc, argv);
- while (opt_F) {
- /* If filename begins with ~, expand it to the user's home */
- /* directory. This does not correctly handle ~yoda, but that */
- /* isn't as bad as it seems because the shell will normally */
- /* be doing the expansion for us; only the hardcoded */
- /* ~/.ltrace.conf should ever use this code. */
- if (opt_F->filename[0] == '~') {
- char path[PATH_MAX];
- char *home_dir = getpwuid(geteuid())->pw_dir;
- strncpy(path, home_dir, PATH_MAX - 1);
- path[PATH_MAX - 1] = '\0';
- strncat(path, opt_F->filename + 1,
- PATH_MAX - strlen(path) - 1);
- read_config_file(path);
- } else {
- read_config_file(opt_F->filename);
- }
- opt_F = opt_F->next;
+ while (opt_F) {
+ /* If filename begins with ~, expand it to the user's home */
+ /* directory. This does not correctly handle ~yoda, but that */
+ /* isn't as bad as it seems because the shell will normally */
+ /* be doing the expansion for us; only the hardcoded */
+ /* ~/.ltrace.conf should ever use this code. */
+ if (opt_F->filename[0] == '~') {
+ char path[PATH_MAX];
+ char *home_dir = getenv("HOME");
+ strncpy(path, home_dir, PATH_MAX - 1);
+ path[PATH_MAX - 1] = '\0';
+ strncat(path, opt_F->filename + 1,
+ PATH_MAX - strlen(path) - 1);
+ read_config_file(path);
+ } else {
+ read_config_file(opt_F->filename);
+ }
+ opt_F = opt_F->next;
}
if (opt_e) {
struct opt_e_t *tmp = opt_e;