From: Kruti Pendharkar Date: Wed, 8 Jan 2025 06:05:50 +0000 (-0800) Subject: Change to common source files not applicable to open-vm-tools. X-Git-Tag: stable-13.0.0~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14431821730e5766062c96e3779d42f8ae62e4de;p=thirdparty%2Fopen-vm-tools.git Change to common source files not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/file/fileLockPrimitive.c b/open-vm-tools/lib/file/fileLockPrimitive.c index 2cd4e645e..e550483df 100644 --- a/open-vm-tools/lib/file/fileLockPrimitive.c +++ b/open-vm-tools/lib/file/fileLockPrimitive.c @@ -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; diff --git a/open-vm-tools/lib/include/file.h b/open-vm-tools/lib/include/file.h index 726d5c14d..d863ba9a8 100644 --- a/open-vm-tools/lib/include/file.h +++ b/open-vm-tools/lib/include/file.h @@ -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);