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.
* 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.
int
File_Unlink(const char *pathName) // IN:
{
- return (FileDeletion(pathName, TRUE) == 0) ? 0 : -1;
+ errno = FileDeletion(pathName, TRUE);
+
+ return errno;
}
/*********************************************************
- * 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
ret = FALSE;
}
} else {
- if (File_Unlink(curPath) == -1) {
+ if (File_Unlink(curPath) != 0) {
ret = FALSE;
}
}