Skip to content

Commit

Permalink
darwintrace: use _simple_dprintf instead of snprintf
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.macosforge.org/repository/darwinbuild/trunk@1048 10a61168-4876-4dac-953b-31e694342555
  • Loading branch information
kvanvechten committed Mar 13, 2013
1 parent 8ed7ebb commit a05bbf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Darwin Build Scripts Change History
-----------------------------------
Release 34 [12-Mar-2013]
- darwintrace: use _simple_dprintf instead of snprintf.

Release 33 [29-Aug-2012]
- darwinup: Fix uninitialised variable in Database.cpp.

Expand Down
13 changes: 6 additions & 7 deletions darwintrace/darwintrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
#define DARWINTRACE_STOP_FD 200
#define DARWINTRACE_BUFFER_SIZE 1024

extern void _simple_dprintf(int __fd, const char *__fmt, ...);

#if DARWINTRACE_DEBUG_OUTPUT
#define dprintf(...) fprintf(stderr, __VA_ARGS__)
#define dprintf(...) _simple_dprintf(STDERR_FILENO, __VA_ARGS__)
#else
#define dprintf(...)
#endif
Expand Down Expand Up @@ -236,12 +238,9 @@ static inline void darwintrace_logpath(int fd, const char *procname, char *tag,
}
}
}
char darwintrace_buf[DARWINTRACE_BUFFER_SIZE];
int size = snprintf(darwintrace_buf, sizeof(darwintrace_buf),
"%s[%d]\t%s\t%s\n",
procname ? procname : darwintrace_progname, darwintrace_pid,
tag, path);
write(fd, darwintrace_buf, size);
_simple_dprintf(fd, "%s[%d]\t%s\t%s\n",
procname ? procname : darwintrace_progname, darwintrace_pid,
tag, path);
}

/* remap resource fork access to the data fork.
Expand Down

0 comments on commit a05bbf4

Please sign in to comment.