]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Add a comment in vmci_sockets.h about why a file handle is "leaked"
authorOliver Kurth <okurth@vmware.com>
Wed, 8 May 2019 22:27:19 +0000 (15:27 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 8 May 2019 22:27:19 +0000 (15:27 -0700)
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.

open-vm-tools/lib/include/vmci_sockets.h

index 29e80780db24136167f43479222fbde8d8220830..6b4f45f2238296344aa0986c7ad586991d738431 100644 (file)
@@ -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) {