From d97cd6a2033c7f77c0cb5d9dfd77bdd2c7754a5b Mon Sep 17 00:00:00 2001 From: William Roberts Date: Fri, 23 Sep 2016 13:55:52 -0700 Subject: [PATCH] libsepol: fix unitialized variable 'nread' on mac build 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 --- libsepol/src/genusers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libsepol/src/genusers.c b/libsepol/src/genusers.c index 57a9a2e7..55682106 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);