config: flip return value of write_section()
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>
René Scharfe committed
Nov 18, 2017 at 11:20 UTC
782c030ea21f02a5dfab3fd023e14084ebeff4dc
1 file changed
+1
-1
config.c
+1
-1
@@ -2319,7 +2319,7 @@ static ssize_t write_section(int fd, const char *key)
2319
struct strbuf sb = store_create_section(key);
2320
ssize_t ret;
2321
2322
- ret = write_in_full(fd, sb.buf, sb.len) == sb.len;
2322
+ ret = write_in_full(fd, sb.buf, sb.len);
2323
strbuf_release(&sb);
2324
2325
return ret;