hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue Sep 30 07:38:20 PDT 2008


 hald/create_cache.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c441223df2fe11fa7e94294e66311f765fe2d136
Author: Markus Rothe <markus at unixforces.net>
Date:   Tue Sep 30 16:38:07 2008 +0200

    fix issue on 64bit big endian architectures.
    
    On 64bit big endian architectures, PowerPC64 in my case, off_t is 64bit. Now
    rule.jump_position is only 32bit. the pad32_write function call in
    set_jump_position only saves 32bit. On little endian architectures this are
    the "correct" bits, but not on 64bit architectures which are big endian. The
    solution is to type cast off_t to a 32bit value and save this one instead of
    the original variable.

diff --git a/hald/create_cache.c b/hald/create_cache.c
index d52f834..232fe98 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -305,15 +305,17 @@ static void remember_jump_position(struct fdi_context *fdi_ctx)
 static void set_jump_position(struct fdi_context *fdi_ctx)
 {
 	off_t	offset;
+	u_int32_t offset32;
 
 	if (fdi_ctx->depth <= 0)
 		DIE(("Rule depth underrun"));
 
 	fdi_ctx->depth--;
 	offset = RULES_ROUND(lseek(fdi_ctx->cache_fd, 0, SEEK_END));
+	offset32 = (u_int32_t)offset;
 	pad32_write(fdi_ctx->cache_fd,
 		fdi_ctx->match_at_depth[fdi_ctx->depth] + offsetof(struct rule, jump_position),
-		&offset, sizeof(fdi_ctx->rule.jump_position));
+		&offset32, sizeof(fdi_ctx->rule.jump_position));
 
 	if (haldc_verbose)
 		HAL_INFO(("modify rule=0x%08x, set jump to 0x%08x",


More information about the hal-commit mailing list