aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-05-12 13:18:58 -0500
committerRob Landley <rob@landley.net>2019-05-12 13:18:58 -0500
commitcf2fa2821e25e641f8b84837d395986c78e3bbea (patch)
tree3a3fda0236f2e4d57d70e0e915b7d4d13c5f2e20
parent706477ba3d7f12b48089a0d2ac3785f7652b4ef2 (diff)
downloadtoybox-cf2fa2821e25e641f8b84837d395986c78e3bbea.tar.gz
Fix readlink0() to blank string on failure.
-rw-r--r--lib/lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 9df04906..7ae2472f 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -1306,7 +1306,7 @@ int readlinkat0(int dirfd, char *path, char *buf, int len)
if (!len) return 0;
len = readlinkat(dirfd, path, buf, len-1);
- if (len<1) return 0;
+ if (len<0) len = 0;
buf[len] = 0;
return len;