Fix perror(3) compliance.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-05-13 20:07:19 +02:00
parent d068a352f7
commit 423fbad835
1 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2015.
This file is part of the Sortix C Library.
@ -22,11 +22,12 @@
*******************************************************************************/
#include <errno.h>
#include <error.h>
#include <stdio.h>
extern "C" void perror(const char* s)
{
error(0, errno, "%s", s);
if ( s && s[0] )
fprintf(stderr, "%s: %m\n", s);
else
fprintf(stderr, "%m\n");
}