From: James Youngman Date: Sun, 6 Apr 2008 11:54:44 +0000 (+0100) Subject: login-utils: cleanup strlen() and fgets() usage X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=489374709c9ebbab8023711f0de449c0951455e0;p=util-linux login-utils: cleanup strlen() and fgets() usage The strlen() returns size_t, not int. The fgets() returns pointer, not int. Signed-off-by: James Youngman Signed-off-by: Karel Zak --- diff --git a/login-utils/islocal.c b/login-utils/islocal.c index 1ee84089..29769804 100644 --- a/login-utils/islocal.c +++ b/login-utils/islocal.c @@ -32,7 +32,7 @@ is_local(char *user) FILE *fd; char line[MAX_LENGTH]; int local = 0; - int len; + size_t len; if(!(fd = fopen(_PATH_PASSWD, "r"))) { fprintf(stderr,_("Can't read %s, exiting."),_PATH_PASSWD); @@ -40,7 +40,7 @@ is_local(char *user) } len = strlen(user); - while(fgets(line, MAX_LENGTH, fd) > 0) { + while(fgets(line, MAX_LENGTH, fd)) { if(!strncmp(line, user, len) && line[len] == ':') { local = 1; break;