rv = PR_Write(fd, data, len) == PRInt32(len) ? NS_OK : NS_ERROR_FAILURE;
if (len) rv = PR_Write(fd, data, len) == PRInt32(len) ? NS_OK : NS_ERROR_FAILURE;
WriteToFile(nsILocalFile *lf, const char *data, PRUint32 len, PRInt32 flags){  PRFileDesc *fd;  nsresult rv = lf->OpenNSPRFileDesc(flags, 0600, &fd);  if (NS_FAILED(rv))    return rv;  rv = PR_Write(fd, data, len) == PRInt32(len) ? NS_OK : NS_ERROR_FAILURE;  PR_Close(fd);  return rv;}