From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] pan/ltp-pan.c: fix file descriptors leaks
Date: Tue, 10 Nov 2020 10:56:17 +0800 [thread overview]
Message-ID: <5FAA0151.3030002@cn.fujitsu.com> (raw)
In-Reply-To: <5FA9ED44.7080909@cn.fujitsu.com>
Hi Cyril
> Hi Cyril, Feiyu
>> Hi!
>>> ltp-pan will leak file descriptors of fopen() into the child process
>>> of the test case, fix this problem by using mode "e" for fopen().
>>
>> Looks good, however this is supported since glibc 2.7 and it does not
>> seem to be supported on musl libc either.
>>
> Yes, musl-libc doesn't support "e" mode for fopen[1].
Sorry, I ignore __fmodeflags function, musl libc supports "e" mode since
0.9.7 after this commit 8582a6e9f ("add 'e' modifier (close-on-exec) to
fopen and fdopen").
https://git.musl-libc.org/cgit/musl/commit/src?id=8582a6e9f25dd7b87d72961f58008052a4cac473
It is about 8 years since musl libc fopen() supports "e". glibc2.7
fopen() supports "e" is about 13 years. Maybe we can use "e" mode now?
>
> [1]https://git.musl-libc.org/cgit/musl/tree/src/stdio/fopen.c
>> I guess that it would be better just to close these files after a fork
>> in the runchild() function, but that would mean that we would have to
>> pass all these files as paramters to the function as well.
> +1
>>
>
>
>
>
next prev parent reply other threads:[~2020-11-10 2:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-09 12:34 [LTP] [PATCH] pan/ltp-pan.c: fix file descriptors leaks Feiyu Zhu
2020-11-09 12:59 ` Cyril Hrubis
2020-11-10 1:30 ` Yang Xu
2020-11-10 2:56 ` Yang Xu [this message]
2020-11-10 10:26 ` Cyril Hrubis
2020-11-11 1:46 ` Yang Xu
2020-11-18 6:17 ` Yang Xu
2020-11-18 21:19 ` Petr Vorel
2020-11-19 3:00 ` Yang Xu
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=5FAA0151.3030002@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.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 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.