aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/cp.c')
-rw-r--r--toys/posix/cp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index 77e7f132..eafabcd1 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -251,8 +251,7 @@ int cp_node(struct dirtree *try)
// make symlink, or make block/char/fifo/socket
if (S_ISLNK(try->st.st_mode)
- ? (0 < (i = readlinkat(tfd, try->name, toybuf, sizeof(toybuf))) &&
- sizeof(toybuf) > i && !(toybuf[i] = '\0') &&
+ ? ((i = readlinkat0(tfd, try->name, toybuf, sizeof(toybuf))) &&
!symlinkat(toybuf, cfd, catch))
: !mknodat(cfd, catch, try->st.st_mode, try->st.st_rdev))
{