All of lore.kernel.org
 help / color / mirror / Atom feed
* MUSL fun
@ 2015-09-15 16:43 Brendan Heading
  2016-02-13 18:48 ` Bernd Kuhls
  0 siblings, 1 reply; 14+ messages in thread
From: Brendan Heading @ 2015-09-15 16:43 UTC (permalink / raw)
  To: lvm-devel

Hello all,

When compiling against the musl C library, an issue comes up in
lib/commands/toolcontext.c. There's some logic that reopens and
updates stdin and stdout in the event that their file descriptors are
in O_WRONLY mode.

================
if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
    goto_out;
stdin = new_stream;
================

musl's view is that stdin/stdout/stderr are read only and are never
meant to be replaced by programs, so they declare them as const, which
means the above section (and similar sections) don't compile.

In theory a straightforward fix would be to do something like:

if (!freopen(NULL, "r", stdin))
     goto out;

.. but I suspect there is a good reason why this isn't done. Can
anyone shed any light on this ? If not I will submit a patch.

regards

Brendan



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-13 21:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 16:43 MUSL fun Brendan Heading
2016-02-13 18:48 ` Bernd Kuhls
2016-02-13 19:22   ` [Buildroot] [lvm-devel] " Brendan Heading
2016-02-13 19:22     ` Brendan Heading
2016-02-13 21:02     ` [linux-lvm] [lvm-devel] " Zdenek Kabelac
2016-02-13 21:02       ` Zdenek Kabelac
2016-02-13 21:19       ` [Buildroot] [lvm-devel] " Brendan Heading
2016-02-13 21:19         ` Brendan Heading
2016-02-13 21:19         ` [linux-lvm] [lvm-devel] " Brendan Heading
2016-02-13 21:31         ` [Buildroot] " Brendan Heading
2016-02-13 21:31           ` Brendan Heading
2016-02-13 21:31           ` [linux-lvm] [lvm-devel] " Brendan Heading
2016-02-13 21:36           ` Zdenek Kabelac
2016-02-13 21:36             ` Zdenek Kabelac

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.