]> err.no Git - util-linux/commitdiff
login-utils: cleanup strlen() and fgets() usage
authorJames Youngman <jay@gnu.org>
Sun, 6 Apr 2008 11:54:44 +0000 (12:54 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Apr 2008 23:44:51 +0000 (01:44 +0200)
The strlen() returns size_t, not int. The fgets() returns
pointer, not int.

Signed-off-by: James Youngman <jay@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/islocal.c

index 1ee84089fe04d2e2d949ca42c0480d285740e54a..297698041f44de7446079b5c32e8cef96c571765 100644 (file)
@@ -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;