From: Morten Welinder <mwelinder@gmail.com>
To: git@vger.kernel.org, torvalds@osdl.org
Subject: [PATCH] write_sha1_buffer
Date: Fri, 15 Apr 2005 20:50:06 -0400 [thread overview]
Message-ID: <118833cc05041517502fa52a89@mail.gmail.com> (raw)
This write will failing sooner or later when someone's disk fills up.
That'll leave someone with
a truncated file.
Signed-off-by: Morten Welinder <mwelinder@gmail.com>
--- read-cache.c
+++ read-cache.c 2005-04-15 20:32:52.111187168 -0400
@@ -276,9 +276,13 @@
" This is bad, bad, BAD!\a\n");
return 0;
}
- write(fd, buf, size);
- close(fd);
- return 0;
+
+ if (write(fd, buf, size) != size) {
+ close(fd);
+ return error("Failed to write file %s\n", filename);
+ }
+
+ return close(fd);
}
next reply other threads:[~2005-04-16 0:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-16 0:50 Morten Welinder [this message]
2005-04-16 2:55 ` [PATCH] write_sha1_buffer Linus Torvalds
2005-04-16 2:59 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=118833cc05041517502fa52a89@mail.gmail.com \
--to=mwelinder@gmail.com \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox