From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] read_cache: cast types from stat to ce_cache
Date: Thu, 10 Jun 2010 11:15:03 +0200 [thread overview]
Message-ID: <a06cc84698f174d914350d6fd6e6b4739d22aa45.1276161176.git.git@drmicha.warpmail.net> (raw)
Cast the system dependent entries of struct stat to unsigned integers
for struct ce_cache just like in other places where we do this already,
to protect against any type conversion issues.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
This does not fix the "filesystem boundary issue" I reported, but I spotted
this when digging through read-cache.c. My device ids would have issues
when int = short.
read-cache.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index e381ea5..aa9b847 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -72,11 +72,11 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
ce->ce_mtime.sec = (unsigned int)st->st_mtime;
ce->ce_ctime.nsec = ST_CTIME_NSEC(*st);
ce->ce_mtime.nsec = ST_MTIME_NSEC(*st);
- ce->ce_dev = st->st_dev;
- ce->ce_ino = st->st_ino;
- ce->ce_uid = st->st_uid;
- ce->ce_gid = st->st_gid;
- ce->ce_size = st->st_size;
+ ce->ce_dev = (unsigned int)st->st_dev;
+ ce->ce_ino = (unsigned int)st->st_ino;
+ ce->ce_uid = (unsigned int)st->st_uid;
+ ce->ce_gid = (unsigned int)st->st_gid;
+ ce->ce_size = (unsigned int)st->st_size;
if (assume_unchanged)
ce->ce_flags |= CE_VALID;
--
1.7.1.501.g23b46
next reply other threads:[~2010-06-10 9:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 9:15 Michael J Gruber [this message]
2010-06-10 15:54 ` [PATCH] read_cache: cast types from stat to ce_cache Junio C Hamano
2010-06-11 13:32 ` Michael J Gruber
2010-06-11 14:15 ` Erik Faye-Lund
2010-06-11 14:59 ` Michael J Gruber
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a06cc84698f174d914350d6fd6e6b4739d22aa45.1276161176.git.git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).