Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0
From: Randy.Dunlap (rddunlap@osdl.org)
Date: Sun Nov 10 2002 - 22:05:05 EST
- Next message: Brian Jackson: "2.5.46-bk6 kconfig errors"
- Previous message: Arnaldo Carvalho de Melo: "Re: 2.5.46-bk3: BUG in skbuff.c:178"
- In reply to: Henning P. Schmiedehausen: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Next in thread: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Henning Schmiedehausen: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Andreas Schwab: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Sun, 10 Nov 2002, Henning P. Schmiedehausen wrote:
| "Randy.Dunlap" <rddunlap@osdl.org> writes:
|
| >+ digit = *str;
| >+ if (is_sign && digit == '-')
| >+ digit = *(str + 1);
|
| If signed is not allowed and you get a "-", you're in an error case
| again...
Yes, and a 0 value is returned.
IOW, asking for an unsigned number (in the format string)
and getting "-123" does return 0.
What should it do?
This function can't return -EINPUTERROR or -EILSEQ.
(since it's after feature-freeze :)
And the original problem was that a leading '-' sign on a
signed number (!) caused a return of 0. At least that is fixed.
So now the problem (?) is that a '-' sign on an unsigned number
returns 0. We can always add a big printk() there that
something is foul. Other ideas?
--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Next message: Brian Jackson: "2.5.46-bk6 kconfig errors"
- Previous message: Arnaldo Carvalho de Melo: "Re: 2.5.46-bk3: BUG in skbuff.c:178"
- In reply to: Henning P. Schmiedehausen: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Next in thread: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Randy.Dunlap: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Henning Schmiedehausen: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Reply: Andreas Schwab: "Re: [PATCH] Re: sscanf("-1", "%d", &i) fails, returns 0"
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
This archive was generated by hypermail 2b29
: Fri Nov 15 2002 - 22:00:21 EST