[PATCH 3/4] Introduce syscall fault injection feature

Dmitry V. Levin ldv at altlinux.org
Fri Jul 29 23:14:59 UTC 2016


On Fri, Jul 29, 2016 at 03:02:57PM +0200, Gabriel Laskar wrote:
> On Wed, Jul 27, 2016 at 08:41:16PM +0200, Nahim El Atmani wrote:
[...]
> > +	negative = 0;
> > +	if (*ss == '-') {
> > +		negative = 1;
> > +		++ss;
> > +	}
> > +
> > +	if (*ss >= '0' && *ss <= '9') {
> 
> We should be able to pass a negative number as an error value, no?
> This also justify the usage of string_to_int instead of string_to_uint.
>
> > +		if (-1 == (opts.err = string_to_int(ss)))
> > +			goto bad_format;
> > +	}
> > +	else {
> > +		opts.err = find_errno_by_name(ss);
> > +		if (opts.err < 0)
> > +			goto bad_format;
> > +	}
> > +	if (negative)
> > +		opts.err *= -1;

The code already handles negative numbers, although in a strange manner.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160730/b2bc12d9/attachment.bin>


More information about the Strace-devel mailing list