diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-16 07:40:05 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-16 07:40:05 +0200 |
commit | 2506e2c63eeddbfecf814fcd441bf65e6fdf3d87 (patch) | |
tree | efa5e8b091fd64be26a39a8719703cddc38c06b9 | |
parent | e01b70358e19d13180533a24158f3e7c930ad234 (diff) | |
download | fastd-2506e2c63eeddbfecf814fcd441bf65e6fdf3d87.tar fastd-2506e2c63eeddbfecf814fcd441bf65e6fdf3d87.zip |
Handle posix_memalign return value
This is nothing we could handle correctly (well, in the long run we should print
and error message), but at least this silences a warning with _FORTIFY_SOURCE.
-rw-r--r-- | src/fastd.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fastd.h b/src/fastd.h index 8b96e14..dc69760 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -293,7 +293,9 @@ static inline size_t alignto(size_t l, size_t a) { static inline fastd_buffer fastd_buffer_alloc(size_t len, size_t head_space, size_t tail_space) { size_t base_len = head_space+len+tail_space; void *ptr; - posix_memalign(&ptr, 16, base_len); + if (posix_memalign(&ptr, 16, base_len)) + return (fastd_buffer){ .base = NULL, .base_len = 0, .data = NULL, .len = 0 }; + return (fastd_buffer){ .base = ptr, .base_len = base_len, .data = ptr+head_space, .len = len }; } |