Welcome to little lamb

Code » limb » commit da7d843

sareadlinkat: Just return -1 on error (as documented)

author Olivier Brunel
2023-02-28 19:56:33 UTC
committer Olivier Brunel
2023-03-02 17:41:17 UTC
parent 2cbf91ef9941aefc83fda76f90abc3908a1c530f

sareadlinkat: Just return -1 on error (as documented)

src/sareadlinkat.c +2 -4

diff --git a/src/sareadlinkat.c b/src/sareadlinkat.c
index 6089c6a..8e46c2d 100644
--- a/src/sareadlinkat.c
+++ b/src/sareadlinkat.c
@@ -1,7 +1,5 @@
 #include <unistd.h>
-#include <errno.h>
 #include "limb/djbunix.h"
-#include "err.h"
 
 int
 sareadlinkat(stralloc *sa, int fd, const char * restrict file)
@@ -10,9 +8,9 @@ sareadlinkat(stralloc *sa, int fd, const char * restrict file)
     ssize_t r;
     for (;;) {
         if (!stralloc_readyplus(sa, len))
-            return (errno = ENOMEM, ERR_MEM);
+            return -1;
         r = readlinkat(fd, file, sa->s + sa->len, len);
-        if (r < 0) return ERR_IO;
+        if (r < 0) return -1;
         if ((size_t) r < len)
             break;
         len += 256;