Page 1 of 1

Re: [Nagios-devel] command pipe concatenated messages

Posted: Mon Dec 29, 2003 3:05 am
by Guest
John P. Rouillard wrote:


> I would use ">> $pipe" to append data for two reasons:
>
> 1 - > clobbers data already existing in files, not sure about in pipes
> 2 - atomic writes occur only if file is opened for append IIRC.
>
>
>>flock(PIPE, LOCK_EX);
>
>
> This should guarantee only one process is accessing the file, but I
> think you have already written to the file by using > in your open, so
> there may be a race condition.

IIRC it is not possible to open a filehandle to a pipe using ">> $pipe",
one must use "> $pipe". I get "Cannot open pipe Illegal seek at ..."
when trying.

Regards,

Jim





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]