Re: [PATCH] Do not segfault because of kernel version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/03/2011 03:26 PM, Jim Rees wrote:
> Luk Claes wrote:
> 
>   > You can't return -1 from a function returning unsigned int.  I think you
>   > want to return something like
>   > 
>   > MAKE_VERSION(9999, 255, 255)
>   
>   Would it not be better to return UINT_MAX in that case to avoid having
>   to change it when version 10000 would be released and to avoid overflows
>   that could potentially order lower?
> 
> Maybe.  I wanted the second and third numbers to be the max possible (255).
> But of course they will be anyway if you return UINT_MAX and are running on
> an architecture that represents ints in two's complement binary.  Which is
> the case today, but wasn't there a port of unix to the System 36 at one
> time?  Ok, that's just silly.
> 
> Yes, just return UINT_MAX.  Fix the other error return too, the one where
> uname fails.  And put in a comment if you can briefly summarize Linus's
> argument.

I thought that a real error like uname failing should still get the
'wrong' return 0, no?

Cheers

Luk
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux