diff options
-rw-r--r-- | src/internal/slibtool_readlink_impl.h | 8 |
1 files 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 <unistd.h> +#include <errno.h> 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; } |