Bug 742147

Summary: header files problem: conflicting types for 'open'
Product: [Fedora] Fedora Reporter: Ales Kozumplik <akozumpl>
Component: e2fsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: esandeen, josef, jzeleny, kzak, oliver
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-12 17:32:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ales Kozumplik 2011-09-29 08:56:39 UTC
With e2fsprogs-devel-1.42-0.3.WIP.0925.fc17.x86_64, the following doesnt compile:

[root@gasoline exp]# cat inc.c 
#include <ext2fs/ext2fs.h>
#include <fcntl.h>

int main(void) {
    return 0;
}

[root@gasoline exp]# gcc inc.c 
In file included from inc.c:2:0:
/usr/include/fcntl.h:134:12: error: conflicting types for ‘open’
/usr/include/fcntl.h:134:1: note: a parameter list with an ellipsis can’t match an empty parameter name list declaration
/usr/include/ext2fs/ext2fs.h:1706:10: note: previous implicit declaration of ‘open’ was here


This is apparently because of the following hunk in the new e2fsprogs-devel:

--- 1688,1732 ----
  	return ((a - 1) / b) + 1;
  }
  
+ _INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...)
+ {
+ 	va_list args;
+ 	mode_t mode;
+ 
+ 	va_start(args, flags);
+ 	mode = va_arg(args, mode_t);
+ 	va_end(args);
+ 
+ 	if (mode)
+ #if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
+ 		return open64(pathname, flags, mode);
+ 	else
+ 		return open64(pathname, flags);
+ #else
+ 		return open(pathname, flags, mode);
+ 	else
+ 		return open(pathname, flags);
+ #endif
+ }
+ 
+ _INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf)
+ {
+ #if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
+ 	return stat64(path, buf);
+ #else
+ 	return stat(path, buf);
+ #endif
+ }
+ 
+ _INLINE_ int ext2fs_fstat(int fd, ext2fs_struct_stat *buf)
+ {
+ #if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
+ 	return fstat64(fd, buf);
+ #else
+ 	return fstat(fd, buf);
+ #endif
+ }
+ 

A workaround that hopefully has no other side effects is to swap the two header includes for fcntl and ext2fs.

Comment 1 Eric Sandeen 2011-09-29 14:50:06 UTC
Sounds like ext2fs.h should first include fcntl.h ...

Comment 2 Eric Sandeen 2011-10-03 17:21:34 UTC
I sent a patch to do what I suggested in comment #1 and Ted merged it.  I'll put that into a rawhide build today.

thanks,
-Eric

Comment 3 Eric Sandeen 2011-10-12 17:32:26 UTC
Should be fixed in recent rawhide.  Please reopen if not ...