| From 86a7b48310e0fd551f7f3d88ea9ad39c1a2807c6 Mon Sep 17 00:00:00 2001 |
| From: Petr Machata <pmachata@redhat.com> |
| Date: Sat, 8 Dec 2012 03:33:47 +0100 |
| Subject: [PATCH] Avoid using non-portable error.h in generic code |
| |
| --- |
| read_config_file.c | 8 +++++--- |
| 1 file changed, 5 insertions(+), 3 deletions(-) |
| |
| --- a/read_config_file.c |
| +++ b/read_config_file.c |
| @@ -27,7 +27,6 @@ |
| #include <stdlib.h> |
| #include <ctype.h> |
| #include <errno.h> |
| -#include <error.h> |
| #include <assert.h> |
| |
| #include "common.h" |
| @@ -1258,8 +1257,11 @@ void |
| init_global_config(void) |
| { |
| struct arg_type_info *info = malloc(2 * sizeof(*info)); |
| - if (info == NULL) |
| - error(1, errno, "malloc in init_global_config"); |
| + if (info == NULL) { |
| + fprintf(stderr, "Couldn't init global config: %s\n", |
| + strerror(errno)); |
| + exit(1); |
| + } |
| |
| memset(info, 0, 2 * sizeof(*info)); |
| info[0].type = ARGTYPE_POINTER; |
| -- |
| 2.25.2 |
| |