Re: gtk_image_new_from_file and mmap



back zeus nuclear kth se wrote:

>     bufp=(int *)mmap((caddr_t)0,len,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_SHARED,fd,offset);
>     if(errno) {
Use if(MAP_FAILED==bufp) . errno could have been modified by a previous
error. It won't be changed unless an error happens. So your mmap is
probably ok.

> How can gtk_image_new_from_file and mmap be 'colliding'?
They don't, I think. Just you're using the wrong test. AT LEAST init
errno to 0 just before the function call, but that's ugly. Better
testing the CORRECT result first and check errno only when a failure
gets reported...

BYtE,
 Diego.



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