Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdlib Distinguish invalid syntax from trailing gar...
details: https://anonhg.NetBSD.org/src/rev/459399484154
branches: trunk
changeset: 818881:459399484154
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Nov 04 20:14:31 2016 +0000
description:
Distinguish invalid syntax from trailing garbage cases. Clarify.
diffstat:
lib/libc/stdlib/strtol.3 | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r ee2a8e6a0d4e -r 459399484154 lib/libc/stdlib/strtol.3
--- a/lib/libc/stdlib/strtol.3 Fri Nov 04 20:06:09 2016 +0000
+++ b/lib/libc/stdlib/strtol.3 Fri Nov 04 20:14:31 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtol.3,v 1.35 2015/11/13 16:00:32 christos Exp $
+.\" $NetBSD: strtol.3,v 1.36 2016/11/04 20:14:31 riastradh Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -225,8 +225,10 @@
errno = 0;
lval = strtol(buf, \*[Am]ep, 10);
-if (buf[0] == '\e0' || *ep != '\e0')
+if (ep == buf)
goto not_a_number;
+if (*ep != '\e0')
+ goto trailing_garbage;
if (errno == ERANGE \*[Am]\*[Am] (lval == LONG_MAX || lval == LONG_MIN))
goto out_of_range;
.Ed
Home |
Main Index |
Thread Index |
Old Index