if (!stat(replacementFile, &fileStack))
if (stat(replacementFile, &fileStack) != 0)
int NativeReplaceFile(const char* replacementFile, const char* doomedFile ){    struct stat fileStack;    // replacement file must exist, doomed file doesn't have to    if (!stat(replacementFile, &fileStack))        return DONE;    // don't have to do anything if the files are the same    if (strcmp(replacementFile, doomedFile))        return DONE;    if (!unlink(doomedFile))    {        if (stat(doomedFile, &fileStack))                return TRY_LATER;    }    else    {      // doomedFile is gone move new file into place      if (!rename(replacementFile, doomedFile))          return TRY_LATER; // this shouldn't happen    }    return DONE;}