From: Petr Vorel <pvorel@suse.cz>
To: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] dup06: Convert to new API
Date: Wed, 10 Jan 2024 19:29:13 +0100 [thread overview]
Message-ID: <20240110182913.GA1768734@pevik> (raw)
In-Reply-To: <20240109095026.792527-1-ruansy.fnst@fujitsu.com>
Hi Shiyang,
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
> ---
> testcases/kernel/syscalls/dup/dup06.c | 141 ++++++++++----------------
> 1 file changed, 52 insertions(+), 89 deletions(-)
> diff --git a/testcases/kernel/syscalls/dup/dup06.c b/testcases/kernel/syscalls/dup/dup06.c
> index e3f8070bf..84fc260a1 100644
> --- a/testcases/kernel/syscalls/dup/dup06.c
> +++ b/testcases/kernel/syscalls/dup/dup06.c
> @@ -1,42 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> /*
> - * Copyright (c) International Business Machines Corp., 2002
> - * ported from SPIE, section2/iosuite/dup1.c, by Airong Zhang
> - * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
...
> + * Copyright (c) International Business Machines Corp., 2002
> + * ported from SPIE, section2/iosuite/dup1.c, by Airong Zhang
> + * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
Could you please also add your or LTP copyright for this rewrite?
E.g.
* Copyright (c) Linux Test Project, 2003-2015
+ your copyright, or just:
* Copyright (c) Linux Test Project, 2003-2024
$ make check-dup06
CHECK testcases/kernel/syscalls/dup/dup06.c
dup06.c:28: ERROR: return is not a function, parentheses are not required
dup06.c:53: ERROR: do not use assignment in if condition
dup06.c:56: WARNING: braces {} are not necessary for any arm of this statement
Therefore I'm going to merge with following change (+ please let me know if you
want to add your copyright).
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
diff --git testcases/kernel/syscalls/dup/dup06.c testcases/kernel/syscalls/dup/dup06.c
index 84fc260a1..e7e27b8f9 100644
--- testcases/kernel/syscalls/dup/dup06.c
+++ testcases/kernel/syscalls/dup/dup06.c
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2002
- * ported from SPIE, section2/iosuite/dup1.c, by Airong Zhang
+ * ported from SPIE, section2/iosuite/dup1.c, by Airong Zhang
* Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2003-2024
*/
/*\
@@ -17,6 +18,7 @@
static int *pfildes;
static int minfd, maxfd, freefds;
static char pfilname[40];
+
static int cnt_free_fds(int maxfd)
{
int freefds = 0;
@@ -25,7 +27,7 @@ static int cnt_free_fds(int maxfd)
if (fcntl(maxfd, F_GETFD) == -1 && errno == EBADF)
freefds++;
- return (freefds);
+ return freefds;
}
static void setup(void)
@@ -50,16 +52,17 @@ static void run(void)
pfildes[0] = SAFE_CREAT(pfilname, 0666);
for (i = 1; i < maxfd; i++) {
- if ((pfildes[i] = dup(pfildes[i - 1])) == -1)
+ pfildes[i] = dup(pfildes[i - 1]);
+ if (pfildes[i] == -1)
break;
}
- if (i < freefds) {
+
+ if (i < freefds)
tst_res(TFAIL, "Not enough files duped");
- } else if (i > freefds) {
+ else if (i > freefds)
tst_res(TFAIL, "Too many files duped");
- } else {
- tst_res(TPASS, "Test passed.");
- }
+ else
+ tst_res(TPASS, "Test passed");
SAFE_UNLINK(pfilname);
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-01-10 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 9:50 [LTP] [PATCH] dup06: Convert to new API Shiyang Ruan
2024-01-09 10:27 ` [LTP] [PATCH] dup07: " Shiyang Ruan
2024-01-10 18:29 ` Petr Vorel [this message]
2024-01-11 2:10 ` [LTP] [PATCH] dup06: " Shiyang Ruan
2024-01-11 2:19 ` [LTP] [PATCH v2 1/2] " Shiyang Ruan
2024-01-11 2:19 ` [LTP] [PATCH v2 2/2] dup07: " Shiyang Ruan
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=20240110182913.GA1768734@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=ruansy.fnst@fujitsu.com \
/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.