]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 8 Jan 2025 06:05:50 +0000 (22:05 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 8 Jan 2025 06:05:50 +0000 (22:05 -0800)
open-vm-tools/lib/file/fileLockPrimitive.c
open-vm-tools/lib/include/file.h

index 2cd4e645e12fddea3aea7186bc619e9043e80641..e550483df345e78878cb937561023463e1b3b7d7 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2007-2021,2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2007-2024 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -54,6 +55,7 @@
 #include "vm_atomic.h"
 #include "util.h"
 #include "hostType.h"
+#include "userlock.h"
 
 #include "unicodeOperations.h"
 
@@ -1212,8 +1214,16 @@ FileLockMakeDirectory(const char *pathName)  // IN:
 
 #if !defined(_WIN32)
    mode_t save;
+   static Atomic_Ptr lckStorage;
 
-   save = umask(0);
+   /* Get and take lock to serial this routine. */
+   MXUserExclLock *lck = MXUser_CreateSingletonExclLock(&lckStorage,
+                                                        "fileLockMakeDirectory",
+                                                        RANK_LEAF);
+
+   MXUser_AcquireExclLock(lck);
+
+   save = umask(0);  // Disable masking; save current value
 #endif
 
    ASSERT(pathName != NULL);
@@ -1221,7 +1231,9 @@ FileLockMakeDirectory(const char *pathName)  // IN:
    err = FileCreateDirectoryRobust(pathName, 0777);
 
 #if !defined(_WIN32)
-   umask(save);
+   umask(save);  // Restore previous value
+
+   MXUser_ReleaseExclLock(lck);
 #endif
 
    return err;
index 726d5c14d58976c09690d9aa39271d8176c9e212..d863ba9a85b216def055a44133dcaf12ab6529ba 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 1998-2020,2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 1998-2024 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -381,7 +382,8 @@ int File_MakeSafeTemp(const char *tag,
 
 Bool File_DoesVolumeSupportAcls(const char *pathName);
 
-Bool File_IsSubPathOf(const char *base, const char *path);
+Bool File_IsSubPathOf(const char *base,
+                      const char *path);
 
 Bool File_DoesVolumeSupportConvertBlocks(const char *pathName);