FreeBSD/contrib/openbsm/bin/auditdistd/receiver.c
/*
 * Function appends data to the trail file that is currently open.
 */
Function appends data to the trail file that is currently open.
Function appends data to the trail file that is currently open .
static int
receiver_append(const unsigned char *data, size_t size)
{
	ssize_t done;
	size_t osize;
	if (adhost->adh_trail_fd == -1) {
		pjdlog_error("Sender requested append without first opening file.");
		return (ADIST_ERROR_WRONG_ORDER);
	}
	osize = size;
	while (size > 0) {
		done = write(adhost->adh_trail_fd, data, size);
		if (done == -1) {
			if (errno == EINTR)
				continue;
			pjdlog_errno(LOG_ERR, "Write to \"%s/%s\" failed",
			    adhost->adh_directory, adhost->adh_trail_name);
			PJDLOG_ASSERT(errno > 0);
			return (ADIST_ERROR_WRITE);
		}
		pjdlog_debug(3, "Wrote %zd bytes into \"%s/%s\".", done,
		    adhost->adh_directory, adhost->adh_trail_name);
		size -= done;
	}
	pjdlog_debug(2, "Appended %zu bytes to file \"%s/%s\".",
	    osize, adhost->adh_directory, adhost->adh_trail_name);
	return (0);
}
static int receiver_append ( const unsigned char * data , size_t size ) { ssize_t done ; size_t osize ; if ( adhost -> adh_trail_fd == -1 ) { pjdlog_error ( " " ) ; return ( ADIST_ERROR_WRONG_ORDER ) ; } osize = size ; while ( size > 0 ) { done = write ( adhost -> adh_trail_fd , data , size ) ; if ( done == -1 ) { if ( errno == EINTR ) continue ; pjdlog_errno ( LOG_ERR , " \" \" " , adhost -> adh_directory , adhost -> adh_trail_name ) ; PJDLOG_ASSERT ( errno > 0 ) ; return ( ADIST_ERROR_WRITE ) ; } pjdlog_debug ( 3 , " \" \" " , done , adhost -> adh_directory , adhost -> adh_trail_name ) ; size -= done ; } pjdlog_debug ( 2 , " \" \" " , osize , adhost -> adh_directory , adhost -> adh_trail_name ) ; return ( 0 ) ; }
Function appends data to the trail file that is currently open.
Function appends data to the trail file that is currently open .
/* We should have opened trail file. */