diff options
author | ASOU Masato <asou@cvs.openbsd.org> | 2022-12-26 04:09:15 +0000 |
---|---|---|
committer | ASOU Masato <asou@cvs.openbsd.org> | 2022-12-26 04:09:15 +0000 |
commit | a00adb4d80b177e06c5272391e412b15d9e962ab (patch) | |
tree | efc2f672c247d37119c17efe17aa1c95deecc149 /sys/dev | |
parent | 5c2bd01e283aa7cc11df04f01cc6f195e819192a (diff) |
Add close vmt.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pv/vmt.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/pv/vmt.c b/sys/dev/pv/vmt.c index 119076cde82..b52932b90db 100644 --- a/sys/dev/pv/vmt.c +++ b/sys/dev/pv/vmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmt.c,v 1.27 2022/12/03 10:57:04 yasuoka Exp $ */ +/* $OpenBSD: vmt.c,v 1.28 2022/12/26 04:09:14 asou Exp $ */ /* * Copyright (c) 2007 David Crawshaw <david@zentus.com> @@ -534,7 +534,7 @@ vmt_kvop(void *arg, int op, char *key, char *value, size_t valuelen) DPRINTF("%s: unable to send rpci command\n", DEVNAME(sc)); sc->sc_rpc_error = 1; error = EIO; - goto done; + goto close; } if (vm_rpc_get_length(&rpci, &rlen, &ack) != 0) { @@ -542,13 +542,13 @@ vmt_kvop(void *arg, int op, char *key, char *value, size_t valuelen) DEVNAME(sc)); sc->sc_rpc_error = 1; error = EIO; - goto done; + goto close; } if (rlen > 0) { if (rlen + 1 > valuelen) { error = EMSGSIZE; - goto done; + goto close; } if (vm_rpc_get_data(&rpci, value, rlen, ack) != 0) { @@ -556,20 +556,23 @@ vmt_kvop(void *arg, int op, char *key, char *value, size_t valuelen) DEVNAME(sc)); sc->sc_rpc_error = 1; error = EIO; - goto done; + goto close; } /* test if response success */ if (rlen < 2 || value[0] != '1' || value[1] != ' ') { DPRINTF("%s: host rejected command: %s\n", DEVNAME(sc), buf); error = EINVAL; - goto done; + goto close; } /* skip response that was tested */ bcopy(value + 2, value, valuelen - 2); value[rlen - 2] = '\0'; } + close: + if (vm_rpc_close(&rpci) != 0) + DPRINTF("%s: unable to close rpci channel\n", DEVNAME(sc)); done: free(buf, M_TEMP, bufsz); return (error); |