From 0ee9587725ac84ec0ea0c65aea144d380e96fc1d Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 1 Feb 2020 01:26:09 +0000 Subject: internals: slbt_readlink(): set errno to ENOBUFS as needed. --- src/internal/slibtool_readlink_impl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/internal/slibtool_readlink_impl.h b/src/internal/slibtool_readlink_impl.h index c29b2d2..644a638 100644 --- a/src/internal/slibtool_readlink_impl.h +++ b/src/internal/slibtool_readlink_impl.h @@ -8,6 +8,7 @@ #define SLIBTOOL_READLINK_IMPL_H #include +#include static inline int slbt_readlink( const char * restrict path, @@ -16,11 +17,12 @@ static inline int slbt_readlink( { ssize_t ret; - if ((ret = readlink(path,buf,bufsize)) <= 0) + if ((ret = readlink(path,buf,bufsize)) <= 0) { return -1; - else if (ret == bufsize) + } else if (ret == bufsize) { + errno = ENOBUFS; return -1; - else { + } else { buf[ret] = 0; return 0; } -- cgit v1.2.3