[PATCH 1/2 v3] tst-fanotify: new simple test
Mike Frysinger
vapier@gentoo.org
Thu Sep 5 06:33:00 GMT 2013
On Wednesday 04 September 2013 04:56:43 Andreas Jaeger wrote:
> On 09/03/2013 05:20 AM, Mike Frysinger wrote:
> > Basic test for the fanotify functions.
>
> This test fails on my Linux 3.10 x86-64 system:
>
> env GCONV_PATH=/home/aj/build/glibc/x86-64/iconvdata LC_ALL=C
> /home/aj/build/glibc/x86-64/elf/ld-linux-x86-64.so.2 --library-path
> /home/aj/build/glibc/x86-64:/home/aj/build/glibc/x86-64/math:/home/aj/build
> /glibc/x86-64/elf:/home/aj/build/glibc/x86-64/dlfcn:/home/aj/build/glibc/x8
> 6-64/nss:/home/aj/build/glibc/x86-64/nis:/home/aj/build/glibc/x86-64/rt:/ho
> me/aj/build/glibc/x86-64/resolv:/home/aj/build/glibc/x86-64/crypt:/home/aj/
> build/glibc/x86-64/nptl /home/aj/build/glibc/x86-64/misc/tst-fanotify >
> /home/aj/build/glibc/x86-64/misc/tst-fanotify.out
> fanotify_init (0, 0) failed: Operation not permitted
> make[2]: *** [/home/aj/build/glibc/x86-64/misc/tst-fanotify.out] Error 1
>
>
> The fanotify_init calls requires the CAP_SYS_ADMIN capability - and
> since I run this as user, I do not have it.
>
> Please let the test fail gracefully in this case and handle EPERM,
try this
-mike
diff --git a/sysdeps/unix/sysv/linux/tst-fanotify.c b/sysdeps/unix/sysv/linux/tst-fanotify.c
index b88995d..b21e160 100644
--- a/sysdeps/unix/sysv/linux/tst-fanotify.c
+++ b/sysdeps/unix/sysv/linux/tst-fanotify.c
@@ -29,11 +29,14 @@ do_test (void)
fd = fanotify_init (0, 0);
if (fd < 0)
{
- if (errno == ENOSYS)
- {
- puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
- return 0;
- }
+ switch (errno) {
+ case ENOSYS:
+ puts ("SKIP: missing support for fanotify (check CONFIG_FANOTIFY=y)");
+ return 0;
+ case EPERM:
+ puts ("SKIP: missing proper permissions for runtime test");
+ return 0;
+ }
perror ("fanotify_init (0, 0) failed");
return 1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130905/8f0e4ddf/attachment.sig>
More information about the Libc-alpha
mailing list