[Nagiosplug-devel] tip for plugin development and temp files

Ferenc Wagner wferi at niif.hu
Thu Dec 29 18:43:06 CET 2011


Matthieu Fournet <fournet.matthieu at gmail.com> writes:

> On Wed, Dec 28, 2011 at 2:22 PM, Ferenc Wagner <wferi at niif.hu> wrote:
>
>> Matthieu Fournet <fournet.matthieu at gmail.com> writes:
>>
>>> I'd like to add my 10 cents to the plugins developer guidelines (at
>>> section "3.3. Don't make temp files unless absolutely required",
>>> http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN254),
>>> regarding the use of temporary files.
>>> [...]
>>> So my advice would be to name temp files like :
>>>
>>> tmp_[plugin_name]_[timestamp]
>>
>> Libc provides the mkstemp() family and tmpfile() for this purpose.  I
>> think you'd be better off using those instead of inventing own methods.
>
> [...]
> Anyway, thanks for your rude welcome to this mailing list. I just wanted to
> warn about a stupid bug I made lately where 2 concurrent executions of my
> plugin were using the same temp file. Leave the documentation as is, and
> expect no more comments from me.

Sorry, I didn't mean being rude or hurting you in any way.  I had to be
terse, but if my language was strong, that must be because English isn't
my first language.  I sincerely apologise.

Back to the technical part: as I understand it, we are in full agreement
and I've got nothing against inserting a warning into the guide.
-- 
Regards,
Feri.




More information about the Devel mailing list