svn commit: r341712 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Dec 7 23:07:53 UTC 2018


Author: kib
Date: Fri Dec  7 23:07:51 2018
New Revision: 341712
URL: https://svnweb.freebsd.org/changeset/base/341712

Log:
  Simplify kern_readlink_vp().
  
  When we detected that the vnode is not symlink, return immediately.
  This moves the readlink code out of else branch and unindents it.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Fri Dec  7 23:05:12 2018	(r341711)
+++ head/sys/kern/vfs_syscalls.c	Fri Dec  7 23:07:51 2018	(r341712)
@@ -2539,20 +2539,19 @@ kern_readlink_vp(struct vnode *vp, char *buf, enum uio
 		return (error);
 #endif
 	if (vp->v_type != VLNK && (vp->v_vflag & VV_READLINK) == 0)
-		error = EINVAL;
-	else {
-		aiov.iov_base = buf;
-		aiov.iov_len = count;
-		auio.uio_iov = &aiov;
-		auio.uio_iovcnt = 1;
-		auio.uio_offset = 0;
-		auio.uio_rw = UIO_READ;
-		auio.uio_segflg = bufseg;
-		auio.uio_td = td;
-		auio.uio_resid = count;
-		error = VOP_READLINK(vp, &auio, td->td_ucred);
-		td->td_retval[0] = count - auio.uio_resid;
-	}
+		return (EINVAL);
+
+	aiov.iov_base = buf;
+	aiov.iov_len = count;
+	auio.uio_iov = &aiov;
+	auio.uio_iovcnt = 1;
+	auio.uio_offset = 0;
+	auio.uio_rw = UIO_READ;
+	auio.uio_segflg = bufseg;
+	auio.uio_td = td;
+	auio.uio_resid = count;
+	error = VOP_READLINK(vp, &auio, td->td_ucred);
+	td->td_retval[0] = count - auio.uio_resid;
 	return (error);
 }
 


More information about the svn-src-head mailing list