* 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_UnlinkNoFollow(const char *pathName) // IN:
{
- return (FileDeletion(pathName, FALSE) == 0) ? 0 : -1;
+ errno = FileDeletion(pathName, FALSE);
+
+ return errno;
}
* Unlink the file, retrying on EBUSY on ESX, up to given timeout.
*
* Results:
- * Return 0 if the unlink is successful. Otherwise, return -1.
+ * 0 success
+ * > 0 failure (errno)
*
* Side effects:
* The file is removed.
File_UnlinkRetry(const char *pathName, // IN:
uint32 maxWaitTimeMilliSec) // IN:
{
- int ret;
-
if (vmx86_server) {
uint32 const unlinkWait = 300;
uint32 waitMilliSec = 0;
do {
- ret = FileDeletion(pathName, TRUE);
+ errno = FileDeletion(pathName, TRUE);
- if (ret != EBUSY || waitMilliSec >= maxWaitTimeMilliSec) {
+ if (errno != EBUSY || waitMilliSec >= maxWaitTimeMilliSec) {
break;
}
waitMilliSec += unlinkWait;
} while (TRUE);
} else {
- ret = FileDeletion(pathName, TRUE);
+ errno = FileDeletion(pathName, TRUE);
}
- return ret == 0 ? 0 : -1;
+ return errno;
}