Skip to content

Commit

Permalink
Tell GCC about the format specifiers in our debug functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nelhage committed Apr 15, 2011
1 parent 4b15af8 commit efb4fa7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions attach.c
Expand Up @@ -93,7 +93,7 @@ int *get_child_tty_fds(struct ptrace_child *child, int statfd, int *count) {
if ((child->error = parse_proc_stat(statfd, &child_status))) if ((child->error = parse_proc_stat(statfd, &child_status)))
return NULL; return NULL;


debug("Resolved child tty: %u", child_status.ctty); debug("Resolved child tty: %x", (unsigned)child_status.ctty);


if (stat("/dev/tty", &tty_st) < 0) { if (stat("/dev/tty", &tty_st) < 0) {
child->error = errno; child->error = errno;
Expand Down Expand Up @@ -169,7 +169,7 @@ int do_setsid(struct ptrace_child *child) {
if (err < 0) if (err < 0)
return err; return err;


debug("Forked a child: %d", child->forked_pid); debug("Forked a child: %ld", child->forked_pid);


err = ptrace_finish_attach(&dummy, child->forked_pid); err = ptrace_finish_attach(&dummy, child->forked_pid);
if (err < 0) if (err < 0)
Expand Down
7 changes: 4 additions & 3 deletions reptyr.h
Expand Up @@ -23,6 +23,7 @@
#define REPTYR_VERSION "0.2dev" #define REPTYR_VERSION "0.2dev"


int attach_child(pid_t pid, const char *pty, int force_stdio); int attach_child(pid_t pid, const char *pty, int force_stdio);
void die(const char *msg, ...); #define __printf __attribute__((format(printf, 1, 2)))
void debug(const char *msg, ...); void __printf die(const char *msg, ...);
void error(const char *msg, ...); void __printf debug(const char *msg, ...);
void __printf error(const char *msg, ...);

0 comments on commit efb4fa7

Please sign in to comment.