Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Feb 2018 16:01:32 +0100
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: Why are stdin/stdout/stderr `FILE *const` in musl?

On Fri, Feb 02, 2018 at 02:24:28PM +0100, CodingMarkus wrote:
> 	void * getOutputPtr ( void ) {
> 		if (/* whatever */) {
> 			return &stdout;
> 		}
> 		return &stderr;
> 	}
> 

Why would you ever need a pointer to stdout or stderr? They are already
pointers to FILE. The right way to do this is

FILE *getOutputPtr (void) {
    return intofile? fopen("log.txt", "w") : whatever? stdout: stderr;
}

Ciao,
Markus

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ