From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/3] syscalls/fchown: Convert fchown02 to the new API
Date: Tue, 25 May 2021 16:57:33 +0200 [thread overview]
Message-ID: <YK0QXeP8740nQJ7e@pevik> (raw)
In-Reply-To: <20210506130950.110267-3-xieziyao@huawei.com>
Hi Ziyao,
thanks! Merged with these changes (NOTE: "for (unsigned int i = 0" breaks on
older compilers, which are represented with CentOS in our travis).
Kind regards,
Petr
diff --git testcases/kernel/syscalls/fchown/fchown02.c testcases/kernel/syscalls/fchown/fchown02.c
index a99962911..d541f0450 100644
--- testcases/kernel/syscalls/fchown/fchown02.c
+++ testcases/kernel/syscalls/fchown/fchown02.c
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
+ * Copyright (c) Linux Test Project, 2003-2021
+ * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
* Copyright (c) International Business Machines Corp., 2001
* 07/2001 Ported by Wayne Boyer
- * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
*/
/*\
@@ -43,6 +44,7 @@ struct test_case_t {
static void run(unsigned int i)
{
+ struct stat stat_buf;
uid_t uid;
gid_t gid;
@@ -53,7 +55,6 @@ static void run(unsigned int i)
TST_EXP_PASS(FCHOWN(*tc[i].fd, uid, gid));
- struct stat stat_buf;
SAFE_STAT(tc[i].filename, &stat_buf);
if (stat_buf.st_uid != uid || stat_buf.st_gid != gid)
@@ -67,13 +68,17 @@ static void run(unsigned int i)
static void setup(void)
{
- for (unsigned int i = 0; i < ARRAY_SIZE(tc); ++i)
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(tc); i++)
*tc[i].fd = SAFE_OPEN(tc[i].filename, O_RDWR | O_CREAT, FILE_MODE);
}
static void cleanup(void)
{
- for (unsigned int i = 0; i < ARRAY_SIZE(tc); ++i)
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(tc); i++)
SAFE_CLOSE(*tc[i].fd);
}
next prev parent reply other threads:[~2021-05-25 14:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 13:09 [LTP] [PATCH 0/3] syscalls/fchown: Convert fchown{01, 02, 03} to the new API Xie Ziyao
2021-05-06 13:09 ` [LTP] [PATCH 1/3] syscalls/fchown: Convert fchown01 " Xie Ziyao
2021-05-25 14:56 ` Petr Vorel
2021-05-06 13:09 ` [LTP] [PATCH 2/3] syscalls/fchown: Convert fchown02 " Xie Ziyao
2021-05-25 14:57 ` Petr Vorel [this message]
2021-05-06 13:09 ` [LTP] [PATCH 3/3] syscalls/fchown: Convert fchown03 " Xie Ziyao
2021-05-25 14:58 ` Petr Vorel
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=YK0QXeP8740nQJ7e@pevik \
--to=pvorel@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.