From: William Roberts <william.c.robe...@intel.com>

Fix this:
genusers.c:63:14: warning: variable 'nread' is uninitialized when used here 
[-Wuninitialized]
                if (buffer[nread - 1] == '\n')
                           ^~~~~
genusers.c:40:15: note: initialize the variable 'nread' to silence this warning
        ssize_t nread;
                     ^
                      = 0

Signed-off-by: William Roberts <william.c.robe...@intel.com>
---
 libsepol/src/genusers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libsepol/src/genusers.c b/libsepol/src/genusers.c
index 57a9a2e..5568210 100644
--- a/libsepol/src/genusers.c
+++ b/libsepol/src/genusers.c
@@ -53,6 +53,7 @@ static int load_users(struct policydb *policydb, const char 
*path)
        }
 
        while(fgets(buffer, 255, fp) != NULL) {
+               nread = strlen(buffer);
 #else
        size_t len = 0;
        __fsetlocking(fp, FSETLOCKING_BYCALLER);
-- 
1.9.1

_______________________________________________
Selinux mailing list
Selinux@tycho.nsa.gov
To unsubscribe, send email to selinux-le...@tycho.nsa.gov.
To get help, send an email containing "help" to selinux-requ...@tycho.nsa.gov.

Reply via email to