Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2012 16:08:04 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236891 - head/sys/kern
Message-ID:  <201206111608.q5BG84Ac094963@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Jun 11 16:08:03 2012
New Revision: 236891
URL: http://svn.freebsd.org/changeset/base/236891

Log:
  Style fixes and simplifications.
  
  MFC after:	1 month

Modified:
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Mon Jun 11 15:40:57 2012	(r236890)
+++ head/sys/kern/uipc_syscalls.c	Mon Jun 11 16:08:03 2012	(r236891)
@@ -134,8 +134,7 @@ getsock_cap(struct filedesc *fdp, int fd
 	int error;
 #endif
 
-	fp = NULL;
-	if ((fdp == NULL) || ((fp = fget_unlocked(fdp, fd)) == NULL))
+	if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL)
 		return (EBADF);
 #ifdef CAPABILITIES
 	/*
@@ -179,7 +178,6 @@ sys_socket(td, uap)
 		int	protocol;
 	} */ *uap;
 {
-	struct filedesc *fdp;
 	struct socket *so;
 	struct file *fp;
 	int fd, error;
@@ -191,7 +189,6 @@ sys_socket(td, uap)
 	if (error)
 		return (error);
 #endif
-	fdp = td->td_proc->p_fd;
 	error = falloc(td, &fp, &fd, 0);
 	if (error)
 		return (error);
@@ -199,7 +196,7 @@ sys_socket(td, uap)
 	error = socreate(uap->domain, &so, uap->type, uap->protocol,
 	    td->td_ucred, td);
 	if (error) {
-		fdclose(fdp, fp, fd, td);
+		fdclose(td->td_proc->p_fd, fp, fd, td);
 	} else {
 		finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops);
 		td->td_retval[0] = fd;
@@ -2313,14 +2310,12 @@ sys_sctp_peeloff(td, uap)
 	} */ *uap;
 {
 #if (defined(INET) || defined(INET6)) && defined(SCTP)
-	struct filedesc *fdp;
 	struct file *nfp = NULL;
 	int error;
 	struct socket *head, *so;
 	int fd;
 	u_int fflag;
 
-	fdp = td->td_proc->p_fd;
 	AUDIT_ARG_FD(uap->sd);
 	error = fgetsock(td, uap->sd, CAP_PEELOFF, &head, &fflag);
 	if (error)
@@ -2378,7 +2373,7 @@ noconnection:
 	 * out from under us.
 	 */
 	if (error)
-		fdclose(fdp, nfp, fd, td);
+		fdclose(td->td_proc->p_fd, nfp, fd, td);
 
 	/*
 	 * Release explicitly held references before returning.

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Mon Jun 11 15:40:57 2012	(r236890)
+++ head/sys/kern/vfs_syscalls.c	Mon Jun 11 16:08:03 2012	(r236891)
@@ -4337,12 +4337,10 @@ getvnode(struct filedesc *fdp, int fd, c
 	struct file *fp;
 #ifdef CAPABILITIES
 	struct file *fp_fromcap;
-#endif
 	int error;
+#endif
 
-	error = 0;
-	fp = NULL;
-	if ((fdp == NULL) || (fp = fget_unlocked(fdp, fd)) == NULL)
+	if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL)
 		return (EBADF);
 #ifdef CAPABILITIES
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206111608.q5BG84Ac094963>