Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern minor cleanup of previous - avoid goto and code dup...
details: https://anonhg.NetBSD.org/src/rev/f704c54afd2e
branches: trunk
changeset: 477674:f704c54afd2e
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Wed Oct 27 13:17:46 1999 +0000
description:
minor cleanup of previous - avoid goto and code duplication
diffstat:
sys/kern/uipc_syscalls.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diffs (51 lines):
diff -r 2be4f855f04a -r f704c54afd2e sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c Wed Oct 27 11:54:56 1999 +0000
+++ b/sys/kern/uipc_syscalls.c Wed Oct 27 13:17:46 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls.c,v 1.46 1999/10/27 11:54:56 darrenr Exp $ */
+/* $NetBSD: uipc_syscalls.c,v 1.47 1999/10/27 13:17:46 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -244,31 +244,25 @@
fp->f_data = (caddr_t)so;
FILE_UNUSE(fp, p);
nam = m_get(M_WAIT, MT_SONAME);
- if ((error = soaccept(so, nam)))
- goto freeit;
- if (SCARG(uap, name)) {
+ if ((error = soaccept(so, nam)) == 0 && SCARG(uap, name)) {
if (namelen > nam->m_len)
namelen = nam->m_len;
/* SHOULD COPY OUT A CHAIN HERE */
if ((error = copyout(mtod(nam, caddr_t),
- (caddr_t)SCARG(uap, name),
- namelen)))
- goto freeit;
- if ((error = copyout((caddr_t)&namelen,
+ (caddr_t)SCARG(uap, name), namelen)) == 0) {
+ error = copyout((caddr_t)&namelen,
(caddr_t)SCARG(uap, anamelen),
- sizeof(*SCARG(uap, anamelen)))))
- goto freeit;
+ sizeof(*SCARG(uap, anamelen)));
+ }
}
+
+ /* if an error occured, free the file descriptor */
+ if (error)
+ ffree(fp);
+
m_freem(nam);
splx(s);
return (error);
-
- freeit:
- ffree(fp);
- m_freem(nam);
- splx(s);
- return (error);
-
}
/* ARGSUSED */
Home |
Main Index |
Thread Index |
Old Index