From: Oliver Kurth Date: Wed, 8 May 2019 22:27:19 +0000 (-0700) Subject: Add a comment in vmci_sockets.h about why a file handle is "leaked" X-Git-Tag: stable-11.0.0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bbb1521360bd140a56d1fbf6a9663d297277901;p=thirdparty%2Fopen-vm-tools.git Add a comment in vmci_sockets.h about why a file handle is "leaked" Let's add a comment in vmci_sockets.h explaining why we intentionally "leak" a file handle in VMCISock_GetAFValueFd. fd is intentionally left open when outFd is NULL. Closing it will break applications running on Linux without a fixed AF for vSockets. In such cases, the fd will be closed during cleanup when the application exits. --- diff --git a/open-vm-tools/lib/include/vmci_sockets.h b/open-vm-tools/lib/include/vmci_sockets.h index 29e80780d..6b4f45f22 100644 --- a/open-vm-tools/lib/include/vmci_sockets.h +++ b/open-vm-tools/lib/include/vmci_sockets.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2017, 2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -697,6 +697,13 @@ struct uuid_2_cid { family = -1; } + /* + * fd is intentionally left open when outFd is NULL. Closing it here + * will break applications running on Linux without a fixed AF for + * vSockets. In such cases, the fd will be closed during cleanup when + * the application exits. Refer to the description of + * VMCISock_GetAFValue. + */ if (family < 0) { close(fd); } else if (outFd) {