Bug 93880

Summary: libbsd: missing include in test/strmode.c
Product: libbsd Reporter: Hanno Böck <hanno>
Component: libbsdAssignee: Guillem Jover <guillem>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch to add missing include

Description Hanno Böck 2016-01-27 10:18:59 UTC
Created attachment 121321 [details]
patch to add missing include

The test in test/strmode.c can fail to compile depending on the optimization flags used.

The constants that are used in this file (S_IFREG etc.) come from the "sys/stat.h" include file. It seems gcc ignores this error if one compiles with "-O2" (default), but if one uses no optimization it fails.

Add the missing include and it works all the time, see attached patch. Please apply.

Reproduce:
./configure CFLAGS=""
make
make check

Error:
strmode.c: In function ‘main’:
strmode.c:41:17: error: ‘S_IFREG’ undeclared (first use in this function)
  strmode(0777 | S_IFREG, mode_str);
                 ^
strmode.c:41:17: note: each undeclared identifier is reported only once for each function it appears in
strmode.c:44:27: error: ‘S_ISUID’ undeclared (first use in this function)
  strmode(0777 | S_IFREG | S_ISUID | S_ISGID | S_ISVTX, mode_str);
                           ^
[...]
Comment 1 Guillem Jover 2016-01-27 16:28:48 UTC
Thanks! This has been merged and released as part of 0.8.2.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.