commit 78ad139e2acc136eef7c94ff566a1150a9fdfb5b
parent 7e9bd31a78b71aa5451f66808fd57f7eabb4e811
Author: sin <sin@2f30.org>
Date: Fri, 3 May 2019 16:41:49 +0100
Use strerror() in block.c
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
@@ -29,7 +30,7 @@ bcreat(char *path, int mode, struct bparam *bpar, struct bctx **bctx)
*bctx = calloc(1, sizeof(**bctx));
if (*bctx == NULL) {
- bseterr("out of memory");
+ bseterr("calloc: %s", strerror(errno));
return -1;
}
@@ -53,7 +54,7 @@ bopen(char *path, int flags, int mode, struct bparam *bpar, struct bctx **bctx)
*bctx = calloc(1, sizeof(**bctx));
if (*bctx == NULL) {
- bseterr("out of memory");
+ bseterr("calloc: %s", strerror(errno));
return -1;
}