git: 1b85302234dd - stable/13 - bhyve/snapshot: fix pthread_create() error check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Jan 2023 18:54:24 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1b85302234dd6afb33d8a6494de6a79a8e7f6f48 commit 1b85302234dd6afb33d8a6494de6a79a8e7f6f48 Author: Robert Wing <rew@FreeBSD.org> AuthorDate: 2022-01-19 17:40:06 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-01-26 18:46:49 +0000 bhyve/snapshot: fix pthread_create() error check pthread_create() returns 0 on success or an error number on failure. Reviewed by: khng, markj Differential Revision: https://reviews.freebsd.org/D33930 (cherry picked from commit 51fbd894ddadd6a1bc4cb72de8ac4e92c013bd36) --- usr.sbin/bhyve/snapshot.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index b99c8beed2be..85c56d519390 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1520,7 +1520,7 @@ init_checkpoint_thread(struct vmctx *ctx) int socket_fd; pthread_t checkpoint_pthread; char vmname_buf[MAX_VMNAME]; - int ret, err = 0; + int err; memset(&addr, 0, sizeof(addr)); @@ -1555,12 +1555,10 @@ init_checkpoint_thread(struct vmctx *ctx) checkpoint_info->ctx = ctx; checkpoint_info->socket_fd = socket_fd; - ret = pthread_create(&checkpoint_pthread, NULL, checkpoint_thread, + err = pthread_create(&checkpoint_pthread, NULL, checkpoint_thread, checkpoint_info); - if (ret < 0) { - err = ret; + if (err != 0) goto fail; - } return (0); fail: