[selinux-testsuite][PATCH] use extfs ioctls only when running on ext[234]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



EXT2_* ioctls are likely to fail on other filesystems,
for example: xfs.

Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>
---
 tests/ioctl/Makefile       |    6 ++++++
 tests/ioctl/test_ioctl.c   |    2 ++
 tests/ioctl/test_noioctl.c |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tests/ioctl/Makefile b/tests/ioctl/Makefile
index 8dce555..def5267 100644
--- a/tests/ioctl/Makefile
+++ b/tests/ioctl/Makefile
@@ -1,4 +1,10 @@
 TARGETS=$(patsubst %.c,%,$(wildcard *.c))
+
+DIR_FS=$(shell df -TP . | awk '{print $2}' | grep 'ext[234]')
+ifneq (x$(DIR_FS),x)
+    CFLAGS += -DUSE_EXTFS_IOCTLS
+endif
+
 all: $(TARGETS)
 clean:
 	rm -f $(TARGETS)
diff --git a/tests/ioctl/test_ioctl.c b/tests/ioctl/test_ioctl.c
index 0852f41..fa5d021 100644
--- a/tests/ioctl/test_ioctl.c
+++ b/tests/ioctl/test_ioctl.c
@@ -49,6 +49,7 @@ int main(int argc, char **argv) {
     exit(1);
   }
 
+#ifdef USE_EXTFS_IOCTLS
   /* This one should hit the FILE__GETATTR or FILE__READ test */
   rc = ioctl(fd, EXT2_IOC_GETVERSION, &val);
   if( rc != 0 ) {
@@ -63,6 +64,7 @@ int main(int argc, char **argv) {
     perror("test_ioctl:EXT2_IOC_SETVERSION");
     exit(1);
   }
+#endif
 
   close(fd);
   exit(0);
diff --git a/tests/ioctl/test_noioctl.c b/tests/ioctl/test_noioctl.c
index ef3fac5..b0ca660 100644
--- a/tests/ioctl/test_noioctl.c
+++ b/tests/ioctl/test_noioctl.c
@@ -68,6 +68,7 @@ int main(int argc, char **argv) {
     exit(1);
   }
 
+#ifdef USE_EXTFS_IOCTLS
   /*
    * This one depends on kernel version:
    * New:  Should hit the FILE__READ test and succeed.
@@ -86,6 +87,7 @@ int main(int argc, char **argv) {
     perror("test_noioctl:EXT2_IOC_SETVERSION");
     exit(1);
   }
+#endif
 
   close(fd);
   exit(0);
-- 
1.7.1


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux