author | Junio C Hamano <junkio@cox.net> | |
Wed, 7 Feb 2007 17:18:57 +0000 (09:18 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 7 Feb 2007 17:18:57 +0000 (09:18 -0800) | ||
commit | fcee5a145d5a9e27afa8086c54e8f718a4a8f1cc | |
tree | 43d1597c8f4075a96083ff3bfa5d4ee35f251567 | tree | snapshot |
parent | 302da67472e322109e6299d38dd1a2c30bde9f4c | commit | diff |
for-each-reflog: fix case for empty log directory
When we remove the last reflog in a directory, opendir() would
succeed and we would iterate over its dirents, expecting retval
to be initialized to zero and setting it to non-zero only upon
seeing an error. If the directory is empty, oops!, we do not
have anybody that touches retval.
The problem is because we initialize retval to errno even on
success from opendir(), which would leave the errno unmolested.
Signed-off-by: Junio C Hamano <junkio@cox.net>
When we remove the last reflog in a directory, opendir() would
succeed and we would iterate over its dirents, expecting retval
to be initialized to zero and setting it to non-zero only upon
seeing an error. If the directory is empty, oops!, we do not
have anybody that touches retval.
The problem is because we initialize retval to errno even on
success from opendir(), which would leave the errno unmolested.
Signed-off-by: Junio C Hamano <junkio@cox.net>
refs.c | diff | blob | history |