summaryrefslogtreecommitdiff
path: root/lib/e2p
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@whamcloud.com>2011-06-11 11:50:01 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-06-11 11:50:01 -0400
commita1a769987b0604d8836541cefe89661ec8db02c7 (patch)
treebf73eadee99a000c1a043e9fa411e88aa7300f6d /lib/e2p
parent65d05cec3d4ae02dec1b15dfec21e571cb83c9cf (diff)
downloade2fsprogs-a1a769987b0604d8836541cefe89661ec8db02c7.tar.gz
misc: fix compile warnings on OSX
The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not really have anything to do with __GNUC__ (which is also used on OS/X and Solaris). Only print these warnings on Linux systems. statfs64() is deprecated on OSX and generates a deliberate warning. Fix some other warnings that show up on OSX builds. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib/e2p')
-rw-r--r--lib/e2p/fgetflags.c8
-rw-r--r--lib/e2p/fsetflags.c15
-rw-r--r--lib/e2p/getflags.c5
-rw-r--r--lib/e2p/setflags.c5
4 files changed, 18 insertions, 15 deletions
diff --git a/lib/e2p/fgetflags.c b/lib/e2p/fgetflags.c
index d66f8e18..ca3ea166 100644
--- a/lib/e2p/fgetflags.c
+++ b/lib/e2p/fgetflags.c
@@ -63,7 +63,7 @@ int fgetflags (const char * name, unsigned long * flags)
#endif
return 0;
-#else
+#else /* !HAVE_STAT_FLAGS || (APPLE_DARWIN && HAVE_EXT2_IOCTLS) */
#if HAVE_EXT2_IOCTLS
int fd, r, f, save_errno = 0;
@@ -83,15 +83,15 @@ int fgetflags (const char * name, unsigned long * flags)
if (save_errno)
errno = save_errno;
return r;
-#else
+#else /* APPLE_DARWIN */
f = -1;
save_errno = syscall(SYS_fsctl, name, EXT2_IOC_GETFLAGS, &f, 0);
*flags = f;
return (save_errno);
-#endif
+#endif /* !APPLE_DARWIN */
+notsupp:
#endif /* HAVE_EXT2_IOCTLS */
#endif
-notsupp:
errno = EOPNOTSUPP;
return -1;
}
diff --git a/lib/e2p/fsetflags.c b/lib/e2p/fsetflags.c
index 30437a20..08dd114d 100644
--- a/lib/e2p/fsetflags.c
+++ b/lib/e2p/fsetflags.c
@@ -51,7 +51,6 @@
int fsetflags (const char * name, unsigned long flags)
{
- struct stat buf;
#if HAVE_CHFLAGS && !(APPLE_DARWIN && HAVE_EXT2_IOCTLS)
unsigned long bsd_flags = 0;
@@ -69,9 +68,10 @@ int fsetflags (const char * name, unsigned long flags)
#endif
return chflags (name, bsd_flags);
-#else
+#else /* !HAVE_CHFLAGS || (APPLE_DARWIN && HAVE_EXT2_IOCTLS) */
#if HAVE_EXT2_IOCTLS
int fd, r, f, save_errno = 0;
+ struct stat buf;
if (!lstat(name, &buf) &&
!S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode)) {
@@ -88,14 +88,15 @@ int fsetflags (const char * name, unsigned long flags)
close (fd);
if (save_errno)
errno = save_errno;
-#else
- f = (int) flags;
- return syscall(SYS_fsctl, name, EXT2_IOC_SETFLAGS, &f, 0);
-#endif
+#else /* APPLE_DARWIN */
+ f = (int) flags;
+ return syscall(SYS_fsctl, name, EXT2_IOC_SETFLAGS, &f, 0);
+#endif /* !APPLE_DARWIN */
return r;
+
+notsupp:
#endif /* HAVE_EXT2_IOCTLS */
#endif
-notsupp:
errno = EOPNOTSUPP;
return -1;
}
diff --git a/lib/e2p/getflags.c b/lib/e2p/getflags.c
index a738fed3..e8716848 100644
--- a/lib/e2p/getflags.c
+++ b/lib/e2p/getflags.c
@@ -57,12 +57,13 @@ int getflags (int fd, unsigned long * flags)
if (!fstat(fd, &buf) &&
!S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode))
goto notsupp;
- r = ioctl (fd, EXT2_IOC_GETFLAGS, &f);
+ r = ioctl(fd, EXT2_IOC_GETFLAGS, &f);
*flags = f;
+
return r;
+notsupp:
#endif /* HAVE_EXT2_IOCTLS */
#endif
-notsupp:
errno = EOPNOTSUPP;
return -1;
}
diff --git a/lib/e2p/setflags.c b/lib/e2p/setflags.c
index cc00b203..72cf4413 100644
--- a/lib/e2p/setflags.c
+++ b/lib/e2p/setflags.c
@@ -38,7 +38,6 @@
int setflags (int fd, unsigned long flags)
{
- struct stat buf;
#if HAVE_CHFLAGS
unsigned long bsd_flags = 0;
@@ -58,6 +57,7 @@ int setflags (int fd, unsigned long flags)
return fchflags (fd, bsd_flags);
#else
#if HAVE_EXT2_IOCTLS
+ struct stat buf;
int f;
if (!fstat(fd, &buf) &&
@@ -66,7 +66,8 @@ int setflags (int fd, unsigned long flags)
return -1;
}
f = (int) flags;
- return ioctl (fd, EXT2_IOC_SETFLAGS, &f);
+
+ return ioctl(fd, EXT2_IOC_SETFLAGS, &f);
#endif /* HAVE_EXT2_IOCTLS */
#endif
errno = EOPNOTSUPP;