Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Thu, Jun 9, 2011 at 11:24 PM, Julien Nabet <serval2412@yahoo.fr> wrote:
Hello,

I had this warning by compiling hwpfilter during some cppcheck cleaning. I
knew nothing about it so I read some links given by Google.
It seems mkstemp is safer since it permits "to avoid race conditions".

In the Unix man of tmpnam, we can read this :
"
BUGS
      Never use this function.  Use mkstemp(3) or tmpfile(3) instead.
"

I'm just a beginner in C++ so what's your opinion about it ?

Functions are only dangerous if you don't use them properly ;)

tmpnam exists in the Windows CRT, but not mkstemp so this change will
break the build on Windows. An easy way to fix the build would be to
define mkstemp to be _mkstemp if the platform is Win32.

The best option probably (don't throw tomatoes at me!) would be to use
something similar to this for windows (maybe in sal?):

http://opengrok.libreoffice.org/xref/libs-core/svx/source/dialog/sendreportw32.cxx#202

-- 
Jesús Corrius <jesus@softcatala.org>
Document Foundation founding member
Mobile: +34 661 11 38 26
Skype: jcorrius | Twitter: @jcorrius

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.