Re: [PATCH] server: assert on failure to open /dev/null (Coverity)
Marcus, IMO,fatal_error() should be preferred over assert() (hoping that fatal_error() is actually marked as no_return) A+ 2011/11/25 Marcus Meissner <meissner(a)suse.de>
Hi,
if we cannot open /dev/null something is really broken. CID 5470
Ciao, Marcus --- server/request.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/server/request.c b/server/request.c index 05c7464..06fdbe8 100644 --- a/server/request.c +++ b/server/request.c @@ -760,6 +760,7 @@ void open_master_socket(void)
/* make sure the stdio fds are open */ fd = open( "/dev/null", O_RDWR ); + assert (fd != -1); while (fd >= 0 && fd <= 2) fd = dup( fd );
if (!server_dir) fatal_error( "directory %s cannot be accessed\n", config_dir ); -- 1.7.1
-- -- Eric Pouech
Eric Pouech <eric.pouech(a)orange.fr> writes:
Marcus,
IMO,fatal_error() should be preferred over assert() (hoping that fatal_error() is actually marked as no_return)
There's no reason to have an error here, it will still work fine even if we can't open /dev/null. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Eric Pouech