Skip to content

Commit

Permalink
get rid of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Sep 5, 2024
1 parent a5b7e5c commit 750b6f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libSegFault/alpha/register-dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static void register_dump(int fd, struct ucontext_t *ctx)
ADD_STRING("\n");

/* Write the stuff out. */
writev(fd, iov, nr);
ssize_t c = writev(fd, iov, nr);
}

#define REGISTER_DUMP register_dump(fd, ctx)
13 changes: 9 additions & 4 deletions libSegFault/signal-safe-trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,34 @@ void do_signal_safe_trace()
{
cpptrace::frame_ptr buffer[100];
std::size_t count = cpptrace::safe_generate_raw_trace(buffer, 100);

pipe_t input_pipe;
pipe(input_pipe.data);
std::ignore = pipe(input_pipe.data);

const pid_t pid = fork();
if (pid == -1)
{
write(STDERR_FILENO, fork_failure_message.data(), fork_failure_message.size());
std::ignore = write(STDERR_FILENO, fork_failure_message.data(), fork_failure_message.size());
return;
}

if (pid == 0)
{ // child
dup2(input_pipe.read_end, STDIN_FILENO);
close(input_pipe.read_end);
close(input_pipe.write_end);
execl(tracer_program.c_str(), tracer_program.c_str(), nullptr);
write(STDERR_FILENO, exec_failure_message.data(), exec_failure_message.size());
std::ignore = write(STDERR_FILENO, exec_failure_message.data(), exec_failure_message.size());
_exit(1);
}

for (std::size_t i = 0; i < count; i++)
{
cpptrace::safe_object_frame frame;
cpptrace::get_safe_object_frame(buffer[i], &frame);
write(input_pipe.write_end, &frame, sizeof(frame));
std::ignore = write(input_pipe.write_end, &frame, sizeof(frame));
}

close(input_pipe.read_end);
close(input_pipe.write_end);
waitpid(pid, nullptr, 0);
Expand Down
2 changes: 1 addition & 1 deletion libSegFault/x86_64/register-dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static void register_dump(int fd, ucontext_t *ctx)
ADD_STRING("\n");

/* Write the stuff out. */
writev(fd, iov, nr);
ssize_t c = writev(fd, iov, nr);
}


Expand Down

0 comments on commit 750b6f1

Please sign in to comment.