[PATCH weston] log: Open log file CLOEXEC so child processes don't get the fd

Khem Raj raj.khem at gmail.com
Thu Jun 4 09:49:02 PDT 2015


> On Jun 4, 2015, at 9:13 AM, Derek Foreman <derekf at osg.samsung.com> wrote:
> 
> On 04/06/15 11:03 AM, Khem Raj wrote:
>> 
>> On Jun 4, 2015 8:54 AM, "Derek Foreman" <derekf at osg.samsung.com
>> <mailto:derekf at osg.samsung.com>> wrote:
>>> 
>>> Uses a glibc extension to fopen(), but we seem ok with glibc
>>> extensions elsewhere (such as printf %m)...
>> 
>> I have been using wayland/weston with musl. So this fix is not good from
>> portability  aspect. There might be glibc ' isms there but it's better
>> to not make it worse
> 
> Looks like musl does indeed support "e" as an fopen() flag.
> 
> Do we still want to do this in a more portable way?

Yes, I know musl is covered in this particular case.
my point was not limited to musl but in general sticking to posix APIs can be a better approach.


> 
>>> 
>>> Signed-off-by: Derek Foreman <derekf at osg.samsung.com
>> <mailto:derekf at osg.samsung.com>>
>>> ---
>>> src/log.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/src/log.c b/src/log.c
>>> index 99bbe18..ef9b54d 100644
>>> --- a/src/log.c
>>> +++ b/src/log.c
>>> @@ -75,7 +75,7 @@ weston_log_file_open(const char *filename)
>>>        wl_log_set_handler_server(custom_handler);
>>> 
>>>        if (filename != NULL)
>>> -               weston_logfile = fopen(filename, "a");
>>> +               weston_logfile = fopen(filename, "ae");
>>> 
>>>        if (weston_logfile == NULL)
>>>                weston_logfile = stderr;
>>> --
>>> 2.1.4
>>> 
>>> _______________________________________________
>>> wayland-devel mailing list
>>> wayland-devel at lists.freedesktop.org
>> <mailto:wayland-devel at lists.freedesktop.org>
>>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150604/98c776bb/attachment.sig>


More information about the wayland-devel mailing list