From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5 1/2] cgroup_core01.c: Set system default umaks to 0
Date: Fri, 1 Mar 2024 09:43:11 +0100 [thread overview]
Message-ID: <20240301084311.GA1660278@pevik> (raw)
In-Reply-To: <CAEemH2cXOi0DpE1p36H-hUxuH2o8WwhD8DUPndBDMoKBbJJnCQ@mail.gmail.com>
Hi Li,
> Hi Wei, Petr,
> Seems the problem Wei met is the default umask of 0077,
> any new files or directories that are created will have their
> permission bits modified by this umask.
> After looking though what you both discussed, I think maybe
> another better choice is to set the umask to '0000' temporarily
> before creating the directory, and then restoring the previous
> umask right after.
> All these operations are just put into cgroup_dir_mk function.
LGTM this approach, please send a patch.
> Something like this:
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -368,8 +368,11 @@ static void cgroup_dir_mk(const struct cgroup_dir
> *const parent,
> new->ctrl_field = parent->ctrl_field;
> new->we_created_it = 0;
> + mode_t old_umask = umask(0000);
nit: umask(0) is the same right?
Kind regards,
Petr
> +
> if (!mkdirat(parent->dir_fd, dir_name, 0777)) {
> new->we_created_it = 1;
> + umask(old_umask);
> goto opendir;
> }
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-03-01 8:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 0:26 [LTP] [PATCH v1] cgroup_core01.c: Set umask before create directory Wei Gao via ltp
2024-02-12 11:54 ` Andrea Cervesato via ltp
2024-02-19 13:48 ` [LTP] [PATCH v2] tst_test.c: Set system default umaks to 0022 Wei Gao via ltp
2024-02-20 9:18 ` Petr Vorel
2024-02-21 8:33 ` Wei Gao via ltp
2024-02-21 16:19 ` Petr Vorel
2024-02-22 13:53 ` Wei Gao via ltp
2024-02-21 7:16 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp
2024-02-21 7:16 ` [LTP] [PATCH v3 1/2] cgroup_core01.c: " Wei Gao via ltp
2024-02-21 7:16 ` [LTP] [PATCH v3 2/2] statx07.c: set umask " Wei Gao via ltp
2024-02-21 7:32 ` Petr Vorel
2024-02-21 8:42 ` [LTP] [PATCH v3 0/2] Set system default umaks to 0 Wei Gao via ltp
2024-02-21 8:42 ` [LTP] [PATCH v4 1/2] cgroup_core01.c: " Wei Gao via ltp
2024-02-21 8:42 ` [LTP] [PATCH v4 2/2] statx07.c: set umask " Wei Gao via ltp
2024-02-22 3:10 ` [LTP] [PATCH v5 0/2] Set system default umaks " Wei Gao via ltp
2024-02-22 3:10 ` [LTP] [PATCH v5 1/2] cgroup_core01.c: " Wei Gao via ltp
2024-03-01 7:26 ` Li Wang
2024-03-01 8:43 ` Petr Vorel [this message]
2024-03-01 10:07 ` Li Wang
2024-02-22 3:10 ` [LTP] [PATCH v5 2/2] statx07.c: set umask " Wei Gao via ltp
2024-03-01 7:28 ` Li Wang
2024-03-01 11:52 ` 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=20240301084311.GA1660278@pevik \
--to=pvorel@suse.cz \
--cc=liwang@redhat.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