Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2021 23:30:22 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 20ac5cda965e - main - fd: make fd/fp mandatory
Message-ID:  <202101072330.107NUM8u075841@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=20ac5cda965eccc34f975674c6efc97c3615a234

commit 20ac5cda965eccc34f975674c6efc97c3615a234
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2020-12-23 13:50:34 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-01-07 23:30:04 +0000

    fd: make fd/fp mandatory
    
    They are both always passed anyway.
---
 sys/kern/kern_descrip.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index ff11ae4f1a61..e1ffdc3baf01 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1976,6 +1976,9 @@ falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int flags,
 	struct file *fp;
 	int error, fd;
 
+	MPASS(resultfp != NULL);
+	MPASS(resultfd != NULL);
+
 	error = falloc_noinstall(td, &fp);
 	if (error)
 		return (error);		/* no reference held on error */
@@ -1986,13 +1989,8 @@ falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int flags,
 		return (error);
 	}
 
-	if (resultfp != NULL)
-		*resultfp = fp;		/* copy out result */
-	else
-		fdrop(fp, td);		/* release local reference */
-
-	if (resultfd != NULL)
-		*resultfd = fd;
+	*resultfp = fp;
+	*resultfd = fd;
 
 	return (0);
 }



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