summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-16 20:05:42 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-16 20:05:42 +0100
commitdb229819366c70bbc45a8dfd657d4214358f61d2 (patch)
treec4a715a5e9bcbb357f00013c2ff42157899471b1
parent7bef106e828d0e68f89eebd7aad7858c86507098 (diff)
downloadfastd-db229819366c70bbc45a8dfd657d4214358f61d2.tar
fastd-db229819366c70bbc45a8dfd657d4214358f61d2.zip
fastd_buffer_alloc: fix output of error message if posix_memalign fails
-rw-r--r--src/fastd.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 4e17cb5..5354871 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -437,8 +437,9 @@ static inline size_t alignto(size_t l, size_t a) {
static inline fastd_buffer_t fastd_buffer_alloc(const fastd_context_t *ctx, size_t len, size_t head_space, size_t tail_space) {
size_t base_len = head_space+len+tail_space;
void *ptr;
- if (posix_memalign(&ptr, 16, base_len))
- exit_errno(ctx, "posix_memalign");
+ int err = posix_memalign(&ptr, 16, base_len);
+ if (err)
+ exit_error(ctx, "posix_memalign: %s", strerror(err));
return (fastd_buffer_t){ .base = ptr, .base_len = base_len, .data = ptr+head_space, .len = len };
}