Re: [Nagios-devel] command pipe concatenated messages

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] command pipe concatenated messages

Post 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]
Locked