From: John Wolfe Date: Mon, 5 Apr 2021 16:01:41 +0000 (-0700) Subject: lib/file/file.c: File_Unlink() X-Git-Tag: stable-11.3.0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48f6c1cefc31cab095718ac4383a4fb7fd08d51b;p=thirdparty%2Fopen-vm-tools.git lib/file/file.c: File_Unlink() Revised File_Unlink() to return 0 for success and an errno for failure. Previously, a failure was indicated by a -1 and the caller had to retrieve the errno. --- diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c index 7b386685d..90677e833 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -258,7 +258,8 @@ File_GetFilePermissions(const char *pathName, // IN: * Errno/GetLastError is available upon failure. * * Results: - * Return 0 if the unlink is successful. Otherwise, returns -1. + * 0 success + * > 0 failure (errno) * * Side effects: * The file is removed. @@ -269,7 +270,9 @@ File_GetFilePermissions(const char *pathName, // IN: int File_Unlink(const char *pathName) // IN: { - return (FileDeletion(pathName, TRUE) == 0) ? 0 : -1; + errno = FileDeletion(pathName, TRUE); + + return errno; } diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c b/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c index c42d05b7e..74592f2ef 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndCommon.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2005-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2005-2021 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 @@ -270,7 +270,7 @@ DnD_DeleteStagingFiles(const char *stagingDir, // IN: ret = FALSE; } } else { - if (File_Unlink(curPath) == -1) { + if (File_Unlink(curPath) != 0) { ret = FALSE; } }