Martin Michlmayr <[EMAIL PROTECTED]> writes:

> * Matthijs Mohlmann <[EMAIL PROTECTED]> [2006-03-11 16:06]:
>> > There are mor errors when compiling with 4.1, e.g:
>> > defrag.c: In function 'walk_zone_ind':
>> > defrag.c:297: warning: cast increases required alignment of target type
> ...
>> When I build defrag, (with gcc 4.1) then I see these errors:
>
> The above is from mips.  Do you think you can work out from the code
> and the warnings what's wrong?  I can test a patch.
>
>> cc1: warnings being treated as errors
>> e2dump.c: In function ?dump_super?:
>> e2dump.c:474: warning: dereferencing type-punned pointer will break
>
> I get that on i386 and can confirm that your patch works, thanks.
> -- 
> Martin Michlmayr
> http://www.cyrius.com/

Please check again that the patch works. Imho the patch is completly
broken and should give segfaults or completly random results.

--------------------[ linux/ext2_fs.h ]--------------------
struct ext2_super_block {
        __u32   s_mtime;                /* Mount time */
        __u32   s_wtime;                /* Write time */
}


--------------------[ time.h ]--------------------
char *ctime(const time_t *timep);


--------------------[ patch ]--------------------
   printf("mount time:%s", 
-        ctime ((time_t *) &s.s_mtime));    /* Mount time */
+        ctime ((time_t *) s.s_mtime));    /* Mount time */


The old prints s.s_mtime while the new code prints the time_t
s.s_mtime points to. That can't be right.



I think the correct way to fix this is:

time_t t = s.s_mtime;
printf("mount time:%s", ctime (&t));

MfG
        Goswin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to