[Crash-utility] [PATCH] address compiler warning for extensions/trace.c

Dave Anderson anderson at redhat.com
Tue Jul 7 15:20:35 UTC 2015


Hello Qiao,

With more recent versions of gcc, extensions/trace.c generates this warning:

  $ make extensions
  ...
  gcc -Wall -g -shared -rdynamic -o trace.so trace.c -fPIC -DX86_64 -DLZO -DSNAPPY -DGDB_7_6
  /tmp/ccSOIphT.o: In function 'ftrace_show':
  /root/crash.git/extensions/trace.c:1560: warning: the use of 'mktemp' is dangerous, better use 'mkstemp'
  ...
  $

I've attached an untested patch that replaces the mktemp() call with mkstemp().
I believe the only behavioral difference is that mkstemp() will create the file
automatically with permissions 600 and open flags of O_EXCL, whereas it is 
currently being opened with permissions 644 and flags (O_WRONLY | O_CREAT | O_TRUNC).

Can you either ACK the patch, or address the warning as you would prefer? 

Thanks,
  Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use_mkstemp.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20150707/c4301f32/attachment.bin>


More information about the Crash-utility mailing list