[PATCH] fix stroul endptr use

The endptr is never NULL, so here we hopefully do the right thing.
This commit is contained in:
kay.sievers@vrfy.org 2004-03-01 23:17:59 -08:00 committed by Greg KH
parent a6f01502bd
commit aebef544cb
2 changed files with 2 additions and 2 deletions

View 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);

View File

@ -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;