All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/3] lib: add helper SAFE_FANOTIFY_INIT
Date: Tue, 15 Aug 2017 15:23:30 +0200	[thread overview]
Message-ID: <20170815132330.GB30800@rei> (raw)
In-Reply-To: <1502719311-18774-2-git-send-email-xzhou@redhat.com>

Hi!
> diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
> index e7f5095..47f87a7 100644
> --- a/lib/tst_safe_macros.c
> +++ b/lib/tst_safe_macros.c
> @@ -17,6 +17,7 @@
>  
>  #define _GNU_SOURCE
>  #include <unistd.h>
> +#include <errno.h>
>  #define TST_NO_DEFAULT_MAIN
>  #include "tst_test.h"
>  #include "tst_safe_macros.h"
> @@ -47,3 +48,25 @@ pid_t safe_getpgid(const char *file, const int lineno, pid_t pid)
>  
>  	return pgid;
>  }
> +
> +int safe_fanotify_init(const char *file, const int lineno,
> +	unsigned int flags, unsigned int event_f_flags)
> +{
> +	int rval;
> +
> +	rval = fanotify_init(flags, event_f_flags);
> +
> +	if (rval == -1) {
> +
> +		if (errno == ENOSYS) {
> +			tst_brk(TCONF,
> +				"fanotify is not configured in this kernel.");
> +		} else {
> +			tst_brk(TBROK | TERRNO,
> +				"%s:%d: fanotify_init() failed",
> +				file, lineno);
> +		}

There is no need for the else branch here, the tst_brk() will exit the
test execution.

> +	}
> +
> +	return rval;
> +}
> -- 
> 1.8.3.1
> 

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2017-08-15 13:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  9:24 [LTP] [PATCH] syscalls/fanotify08: add sanity check for FAN_CLOEXEC Xiong Zhou
2017-06-05 14:03 ` Cyril Hrubis
2017-08-11  3:13   ` [LTP] [PATCH v2] " Xiong Zhou
2017-08-11  8:41     ` Cyril Hrubis
2017-08-14 14:01       ` [LTP] [PATCH v3 0/3] add SAFE_FANOTIFY_INIT and FAN_CLOEXEC cases Xiong Zhou
2017-08-14 14:01         ` [LTP] [PATCH v3 1/3] lib: add helper SAFE_FANOTIFY_INIT Xiong Zhou
2017-08-15 13:23           ` Cyril Hrubis [this message]
2017-08-14 14:01         ` [LTP] [PATCH v3 2/3] fanotify: rewrite old cases with new lib Xiong Zhou
2017-08-15 13:33           ` Cyril Hrubis
2017-08-14 14:01         ` [LTP] [PATCH v3 3/3] syscalls/fanotify0[89]: add sanity check for FAN_CLOEXEC Xiong Zhou
2017-08-15 13:36           ` Cyril Hrubis
2017-08-16  7:15             ` [LTP] [PATCH v4 0/3] add SAFE_FANOTIFY_INIT and FAN_CLOEXEC check Xiong Zhou
2017-08-16  7:15               ` [LTP] [PATCH v4 1/3] lib: add helper SAFE_FANOTIFY_INIT Xiong Zhou
2017-08-18 10:22                 ` Cyril Hrubis
2017-08-21  3:12                   ` Xiong Zhou
2017-08-21 11:45                     ` Cyril Hrubis
2017-08-16  7:15               ` [LTP] [PATCH v4 2/3] fanotify: rewrite old cases with new lib Xiong Zhou
2017-08-18 10:24                 ` Cyril Hrubis
2017-08-16  7:15               ` [LTP] [PATCH v4 3/3] syscalls/fanotify08: add sanity check for FAN_CLOEXEC Xiong Zhou
2017-08-18 10:25                 ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170815132330.GB30800@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.