Trivial fixes on error paths
* strace.c (startup_attach): Emit message on fork() failure.
(startup_child): Remove non-informative comment.
* util.c (ptrace_restart): use perror_msg() on error instead of fprintf().
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/strace.c b/strace.c
index fcdae0b..722a0f0 100644
--- a/strace.c
+++ b/strace.c
@@ -424,7 +424,7 @@
if (daemonized_tracer) {
pid_t pid = fork();
if (pid < 0) {
- _exit(1);
+ perror_msg_and_die("fork");
}
if (pid) { /* parent */
/*
@@ -641,7 +641,7 @@
# ifndef FREEBSD
pause();
# else
- kill(pid, SIGSTOP); /* stop HERE */
+ kill(pid, SIGSTOP);
# endif
#else /* !USE_PROCFS */
if (!daemonized_tracer) {
diff --git a/util.c b/util.c
index 20311fc..0658bc0 100644
--- a/util.c
+++ b/util.c
@@ -224,8 +224,7 @@
msg = "CONT";
if (op == PTRACE_DETACH)
msg = "DETACH";
- fprintf(stderr, "strace: ptrace(PTRACE_%s,1,%d): %s\n",
- msg, sig, strerror(err));
+ perror_msg("ptrace(PTRACE_%s,1,%d)", msg, sig);
return -1;
}