Use strerror() for more usefull errormessages

This commit is contained in:
Axel Wagner
2011-01-01 16:48:30 +01:00
parent 4c7f131fc5
commit 2aeea30cc7
5 changed files with 15 additions and 12 deletions

View File

@ -11,6 +11,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <yajl/yajl_parse.h>
#include "common.h"
@ -184,7 +185,7 @@ static int workspaces_map_key_cb(void *params_, const unsigned char *keyVal, uns
params->cur_key = malloc(sizeof(unsigned char) * (keyLen + 1));
if (params->cur_key == NULL) {
ELOG("Could not allocate memory!\n");
ELOG("Could not allocate memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
strncpy(params->cur_key, (const char*) keyVal, keyLen);