Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git_mkstemps: correctly test return value of open()
author
Dale R. Worley
<worley@alum.mit.edu>
Fri, 12 Jul 2013 08:58:35 +0000
(10:58 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 12 Jul 2013 17:30:08 +0000
(10:30 -0700)
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>
wrapper.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
62e91ef
)
diff --git
a/wrapper.c
b/wrapper.c
index bac59d2c41bae7441038b30728c696b6280f4c2d..094b2ab9836a4d1d13d432982c6b2582ee3cb13a 100644
(file)
--- 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).