chiark / gitweb /
[PATCH] fix stroul endptr use
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Tue, 2 Mar 2004 07:17:59 +0000 (23:17 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:35:06 +0000 (21:35 -0700)
The endptr is never NULL, so here we hopefully do the right thing.

klibc_fixups.c
namedev.c

index 1241eb7d108061c98fc2af0c114f807dfe757983..99460c32f71240ce08a9c5fad00c9954427206e9 100644 (file)
@@ -74,7 +74,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile)
 
                if (strcmp(uname, name) == 0) {
                        id = strtoul(idstr, &tail, 10);
-                       if (tail == NULL)
+                       if (tail[0] != '\0')
                                id = -1;
                        else
                                dbg("id for '%s' is '%li'", name, id);
index 2ebf276f6b9141e081ad849c7a160061174620aa..ed8d6c1808bf3c747e4b0a14be5a49f99839a2cc 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -198,7 +198,7 @@ static int get_format_len(char **str)
 
        if (isdigit(*str[0])) {
                num = (int) strtoul(*str, &tail, 10);
-               if (tail != NULL) {
+               if (num > 0) {
                        *str = tail;
                        dbg("format length=%i", num);
                        return num;