summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorDale R. Worley <worley@alum.mit.edu>2013-07-12 10:58:35 +0200
committerJunio C Hamano <gitster@pobox.com>2013-07-12 10:30:08 -0700
commita2cb86c1524b7af20e609ca8d3db0b60b5c1d575 (patch)
treeca904b3742a076666a6dc1f726aa159368f57a35 /wrapper.c
parent62e91efafd2030b7dc33ac6450b4e9a316e6ecc6 (diff)
downloadgit-a2cb86c1524b7af20e609ca8d3db0b60b5c1d575.tar.gz
git_mkstemps: correctly test return value of open()
open() returns -1 on failure, and indeed 0 is a possible success value if the user closed stdin in our process. Fix the test. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wrapper.c b/wrapper.c
index bac59d2c41..094b2ab983 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -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).