Bug 219

Summary: Error when compiling Akai.cpp with -D_FORTIFY_SOURCE=2
Product: libgig Reporter: Chris Arndt <linuxsampler>
Component: libgigAssignee: Christian Schoenebeck <cuse>
Status: CLOSED FIXED    
Severity: normal    
Priority: P5    
Version: SVN Trunk   
Hardware: PC   
OS: Linux   

Description Chris Arndt 2014-05-29 04:12:05 CEST
When -D_FORTIFY_SOURCE=2 preprocessor macro is used, compilation of Akai.cpp fails with an error:

In function 'int open(const char*, int, ...)',
    inlined from 'bool DiskImage::WriteImage(const char*)' at Akai.cpp:1880:66:
/usr/include/bits/fcntl2.h:50:26: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
    __open_missing_mode ();

(Full log here: http://pastebin.com/MwcvtnTr)

With -D_FORTIFY_SOURCE=2 a call to open with the O_CREAT flag needs to specify a file permission mode as the third argument. Here's a patch that fixes this:

http://pastebin.com/SeDpfakK

AFAIK -D_FORTIFY_SOURCE=2 is in the default CPP_FLAGS of the package build system in many distributions, for example Arch Linux, so libgig should be compatible with it.
Comment 1 Christian Schoenebeck 2014-06-01 02:32:04 CEST
Fixed in SVN r2587. Thanks!