aboutsummaryrefslogtreecommitdiffstats
path: root/libselinux/src/label_android_property.c
diff options
context:
space:
mode:
authorRichard Haines <richard_c_haines@btinternet.com>2015-11-23 13:52:41 +0000
committerStephen Smalley <sds@tycho.nsa.gov>2015-11-24 16:37:57 -0500
commit46320aefc22f04c5553d589d961b54ef41874d96 (patch)
tree7aad27006f226b32a7f8b29840b9c6c5437731be /libselinux/src/label_android_property.c
parent6c925600fa72e509e0184fc48174a7939de974ee (diff)
downloadandroid_external_selinux-46320aefc22f04c5553d589d961b54ef41874d96.tar.gz
android_external_selinux-46320aefc22f04c5553d589d961b54ef41874d96.tar.bz2
android_external_selinux-46320aefc22f04c5553d589d961b54ef41874d96.zip
libselinux: Correct line count for property and service contexts files
When a line number is displayed for context errors they are x2 the correct value, so reset line count for each pass. Signed-off-by: Richard Haines <richard_c_haines@btinternet.com> Acked-by: Jeff Vander Stoep <jeffv@google.com>
Diffstat (limited to 'libselinux/src/label_android_property.c')
-rw-r--r--libselinux/src/label_android_property.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libselinux/src/label_android_property.c b/libselinux/src/label_android_property.c
index 712eecba..fea1f8fb 100644
--- a/libselinux/src/label_android_property.c
+++ b/libselinux/src/label_android_property.c
@@ -132,7 +132,7 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
const char *path = NULL;
FILE *fp;
char line_buf[BUFSIZ];
- unsigned int lineno = 0, maxnspec, pass;
+ unsigned int lineno, maxnspec, pass;
int status = -1;
struct stat sb;
@@ -166,6 +166,7 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
maxnspec = UINT_MAX / sizeof(spec_t);
for (pass = 0; pass < 2; pass++) {
data->nspec = 0;
+ lineno = 0;
while (fgets(line_buf, sizeof(line_buf) - 1, fp)
&& data->nspec < maxnspec) {