Ejemplo n.º 1
0
static void
generate_trailer_token(const char *directory, const char *token_filename)
{
	token_t *trailer_token;

	trailer_token = au_to_trailer(trailer_token_len);
	if (trailer_token == NULL)
		err(EX_UNAVAILABLE, "au_to_trailer");
	write_token(directory, token_filename, trailer_token);
}
Ejemplo n.º 2
0
int
rec_close(struct token_buffer *tb)
{
	uint32_t len;

	/* Ensure we have a valid arguments. */
	if (tb == NULL)
		return (-1);

	/* Append the record trailer. */
	rec_append(tb, au_to_trailer(0));

	/*
	 * XXX-MAK: There's got to be a better approach to setting the record
	 * length. On the upside, this hack works for all four header types.
	 */
	len = htonl(tb->used);
	memmove(&tb->data[1], &len, sizeof(len));
	memmove(&tb->data[tb->used - 4], &len, sizeof(len));

	return (0);
}