Beispiel #1
0
void
log_packet(u_char *p, int len, char *prefix, int level)
{
    strcpy(line, prefix);
    linep = line + strlen(line);
    format_packet(p, len, pr_log, NULL);
    if (linep != line)
	syslog(level, "%s", line);
}
Beispiel #2
0
void packet_buf_write(struct strbuf *buf, const char *fmt, ...)
{
	va_list args;
	unsigned n;

	va_start(args, fmt);
	n = format_packet(fmt, args);
	va_end(args);
	strbuf_add(buf, buffer, n);
}
Beispiel #3
0
void packet_write(int fd, const char *fmt, ...)
{
	va_list args;
	unsigned n;

	va_start(args, fmt);
	n = format_packet(fmt, args);
	va_end(args);
	safe_write(fd, buffer, n);
}
Beispiel #4
0
static int packet_write_fmt_1(int fd, int gently,
			      const char *fmt, va_list args)
{
	struct strbuf buf = STRBUF_INIT;
	ssize_t count;

	format_packet(&buf, fmt, args);
	count = write_in_full(fd, buf.buf, buf.len);
	if (count == buf.len)
		return 0;

	if (!gently) {
		check_pipe(errno);
		die_errno("packet write with format failed");
	}
	return error("packet write with format failed");
}