Merge branch 'tr/fd-gotcha-fixes'

Two places we did not check return value (expected to be a file
descriptor) correctly.

* tr/fd-gotcha-fixes:
  run-command: dup_devnull(): guard against syscalls failing
  git_mkstemps: correctly test return value of open()
This commit is contained in:
Junio C Hamano
2013-07-22 11:23:12 -07:00
2 changed files with 5 additions and 2 deletions

View File

@ -322,7 +322,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
template[5] = letters[v % num_letters]; v /= num_letters;
fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
if (fd > 0)
if (fd >= 0)
return fd;
/*
* Fatal error (EPERM, ENOSPC etc).