config: flip return value of write_section()
authorRené Scharfe <l.s.r@web.de>
Sat, 18 Nov 2017 10:20:04 +0000 (11:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 18 Nov 2017 11:38:40 +0000 (20:38 +0900)
d9bd4cbb9cc (config: flip return value of store_write_*()) made
write_section() follow the convention of write(2) to return -1 on error
and the number of written bytes on success. 3b48045c6c7 (Merge branch
'sd/branch-copy') changed it back to returning 0 on error and 1 on
success, but left its callers still checking for negative values.

Let write_section() follow the convention of write(2) again to meet the
expectations of its callers.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
index 4831c1273542706437139ccc379afb38e7ca3d3b..201ad36d34376ceee44b530197863924fb7051b4 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2319,7 +2319,7 @@ static ssize_t write_section(int fd, const char *key)
        struct strbuf sb = store_create_section(key);
        ssize_t ret;
 
-       ret = write_in_full(fd, sb.buf, sb.len) == sb.len;
+       ret = write_in_full(fd, sb.buf, sb.len);
        strbuf_release(&sb);
 
        return ret;