Mercurial > blahgd > fmt4
changeset 1109:5b0116b502d1
file cache: use correct str allocation error handling
str_alloc() has been returning errno's instead of NULL since 7544e9990bc1.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 26 Mar 2018 22:31:44 -0400 |
parents | ff12795dbe84 |
children | fd7503352fd4 |
files | file_cache.c |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/file_cache.c Mon Mar 12 15:29:09 2018 +0200 +++ b/file_cache.c Mon Mar 26 22:31:44 2018 -0400 @@ -326,10 +326,14 @@ } node->contents = str_alloc(tmp); - if (!node->contents) { - DBG("file (%s) str_alloc error", node->name); + if (IS_ERR(node->contents)) { + int ret = PTR_ERR(node->contents); + + DBG("file (%s) str_alloc error: %s", node->name, xstrerror(ret)); free(tmp); - return -ENOMEM; + + node->contents = NULL; + return ret; } node->needs_reload = false;