X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-fetch--tool.c;h=e2f8ede9ae4507ed1e431f9d14fc649f6475627d;hb=d1637a07f684acd80007723f94c4da9649d85525;hp=3145c01f7e0e81bf28314b92737ccf2abb129dcd;hpb=da94faf671c6b7c4db1ae07137bd93e31e232b4c;p=git.git diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c index 3145c01f7..e2f8ede9a 100644 --- a/builtin-fetch--tool.c +++ b/builtin-fetch--tool.c @@ -1,3 +1,4 @@ +#include "builtin.h" #include "cache.h" #include "refs.h" #include "commit.h" @@ -6,11 +7,11 @@ static char *get_stdin(void) { - int offset = 0; + size_t offset = 0; char *data = xmalloc(CHUNK_SIZE); while (1) { - int cnt = xread(0, data + offset, CHUNK_SIZE); + ssize_t cnt = xread(0, data + offset, CHUNK_SIZE); if (cnt < 0) die("error reading standard input: %s", strerror(errno)); @@ -35,17 +36,14 @@ static int update_ref(const char *action, unsigned char *sha1, unsigned char *oldval) { - int len; char msg[1024]; char *rla = getenv("GIT_REFLOG_ACTION"); static struct ref_lock *lock; if (!rla) rla = "(reflog update)"; - len = snprintf(msg, sizeof(msg), "%s: %s", rla, action); - if (sizeof(msg) <= len) - die("insanely long action"); - lock = lock_any_ref_for_update(refname, oldval); + snprintf(msg, sizeof(msg), "%s: %s", rla, action); + lock = lock_any_ref_for_update(refname, oldval, 0); if (!lock) return 1; if (write_ref_sha1(lock, sha1, msg) < 0)