ref: 230f849229f8443703ab281bd1f1cd3ef4eb6d6e
parent: c37253fe5ae5e838334baa67ddb2b4d264815591
author: ISSOtm <eldredhabert0@gmail.com>
date: Tue Feb 11 04:02:59 EST 2020
Fix error output slightly broken on Windows Apparently, `perror` on Windows forces a newline before itself, which is not the behavior intended. Instead, print the error message inline.
--- a/src/extern/err.c
+++ b/src/extern/err.c
@@ -6,9 +6,11 @@
* SPDX-License-Identifier: MIT
*/
+#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "extern/err.h"
@@ -39,7 +41,8 @@
vfprintf(stderr, fmt, ap);
fputs(": ", stderr);
}
- perror(NULL);
+ fputs(strerror(errno), stderr);
+ putc('\n', stderr);
exit(status);
}