public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jinseok Kim <always.starving0@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
Date: Sun,  8 Feb 2026 02:06:29 +0900	[thread overview]
Message-ID: <20260207170632.2795-1-always.starving0@gmail.com> (raw)

These are small cleanups to align with current LTP style:
- Use SAFE_ wrappers instead of manual calls
- Remove trailing comma in tst_res() for cleaner logs

Signed-off-by: Jinseok Kim <always.starving0@gmail.com>
---
 testcases/kernel/syscalls/inotify/inotify02.c | 21 ++++---------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/testcases/kernel/syscalls/inotify/inotify02.c b/testcases/kernel/syscalls/inotify/inotify02.c
index 709a92830..314c1bd49 100644
--- a/testcases/kernel/syscalls/inotify/inotify02.c
+++ b/testcases/kernel/syscalls/inotify/inotify02.c
@@ -64,11 +64,7 @@ void verify_inotify(void)
 	strcpy(event_set[test_cnt].name, "");
 	test_cnt++;

-	if ((fd = creat(FILE_NAME1, 0755)) == -1) {
-		tst_brk(TBROK | TERRNO,
-			"creat(\"%s\", 755) failed", FILE_NAME1);
-	}
-
+	fd = SAFE_CREAT(FILE_NAME1, 0755);
 	event_set[test_cnt].mask = IN_CREATE;
 	strcpy(event_set[test_cnt].name, FILE_NAME1);
 	test_cnt++;
@@ -89,11 +85,7 @@ void verify_inotify(void)
 	strcpy(event_set[test_cnt].name, FILE_NAME2);
 	test_cnt++;

-	if (getcwd(fname1, BUF_SIZE) == NULL) {
-		tst_brk(TBROK | TERRNO,
-			"getcwd(%p, %d) failed", fname1, BUF_SIZE);
-	}
-
+	SAFE_GETCWD(fname1, BUF_SIZE);
 	snprintf(fname2, BUF_SIZE, "%s.rename1", fname1);
 	SAFE_RENAME(fname1, fname2);
 	event_set[test_cnt].mask = IN_MOVE_SELF;
@@ -120,12 +112,7 @@ void verify_inotify(void)
 	test_cnt++;

 	int len, i = 0, test_num = 0;
-	if ((len = read(fd_notify, event_buf, EVENT_BUF_LEN)) == -1) {
-		tst_brk(TBROK | TERRNO,
-			"read(%d, buf, %zu) failed",
-			fd_notify, EVENT_BUF_LEN);
-
-	}
+	len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);

 	while (i < len) {
 		struct inotify_event *event;
@@ -208,7 +195,7 @@ static void cleanup(void)
 {
 	if (reap_wd && myinotify_rm_watch(fd_notify, wd) < 0) {
 		tst_res(TWARN,
-			"inotify_rm_watch (%d, %d) failed,", fd_notify, wd);
+			"inotify_rm_watch (%d, %d) failed", fd_notify, wd);
 	}

 	if (fd_notify > 0)
--
2.43.0

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-02-07 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-07 17:06 Jinseok Kim [this message]
2026-02-11  9:11 ` [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues Andrea Cervesato via ltp
2026-02-11 10:12   ` Jinseok Kim
2026-02-11 10:25     ` Andrea Cervesato via ltp
2026-02-11 16:31 ` Cyril Hrubis
2026-02-20 12:09 ` Andrea Cervesato via ltp

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=20260207170632.2795-1-always.starving0@gmail.com \
    --to=always.starving0@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox