summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9130ac1)
raw | patch | inline | side by side (parent: 9130ac1)
author | Eric Wong <normalperson@yhbt.net> | |
Thu, 11 Jan 2007 21:43:40 +0000 (13:43 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 11 Jan 2007 22:49:45 +0000 (14:49 -0800) |
Unfortunately, while {read,write}_in_full do take into account
zero-sized reads/writes; their die and whine variants do not.
I have a repository where there are zero-sized files in
the history that was triggering these things.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
zero-sized reads/writes; their die and whine variants do not.
I have a repository where there are zero-sized files in
the history that was triggering these things.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | patch | blob | history | |
write_or_die.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 53e25f278c6193860431f63a3c9de97f4e347f27..18dd89b50a23a4a99b51d8e99d0c67cace2a1a2d 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
{
ssize_t size;
+ if (!len)
+ return 0;
size = write_in_full(fd, buf, len);
if (!size)
return error("file write: disk full");
diff --git a/write_or_die.c b/write_or_die.c
index 7f99a22aed43afd8ca06d3eafef8d3e836b15107..488de721da8a316c06bf53e9091633e5ac415390 100644 (file)
--- a/write_or_die.c
+++ b/write_or_die.c
{
ssize_t loaded;
+ if (!count)
+ return;
loaded = read_in_full(fd, buf, count);
if (loaded == 0)
die("unexpected end of file");
{
ssize_t written;
+ if (!count)
+ return;
written = write_in_full(fd, buf, count);
if (written == 0)
die("disk full?");
{
ssize_t written;
+ if (!count)
+ return 1;
written = write_in_full(fd, buf, count);
if (written == 0) {
fprintf(stderr, "%s: disk full?\n", msg);
{
ssize_t written;
+ if (!count)
+ return 1;
written = write_in_full(fd, buf, count);
if (written == 0) {
fprintf(stderr, "%s: disk full?\n", msg);