set errno=0 to prevent mywarn from printing perror