[obv] Fix unused-but-set-variable error [Re: [OB] Fix linux-low.c build error]

Jan Kratochvil jan.kratochvil@redhat.com
Mon Dec 19 10:23:00 GMT 2011


On Mon, 19 Dec 2011 07:26:03 +0100, Yao Qi wrote:
> This reminds me that I committed a similar patch some days ago.  Here is a
> patch to revert.
[...]
> -	  /* Fix compiler's warning: ignoring return value of 'write'.  */
> -	  ret = write (fd, buf, 1);
> +	  if (write (fd, buf, 1) < 0)
> +	    /* Errors ignored.  */;
>  	  close (fd);
>  	}
>      }

I would add a comment that the variable "ret" is already used elsewhere incl.
reading it in that function.  This is the reason it did not trigger the
unused-but-set-variable error.

Still sure I agree such patch is useful (+Joel suggests more comments for it),
this is unwised code dependency.  .


Thanks,
Jan



More information about the Gdb-patches mailing list