Skip to content

Commit ad1151e

Browse files
committed
Read in the extra line of the default store file
Corresponds with Superuser repo commit e16376e17a7680c50bdf626a73f46a8b60bd4793
1 parent 6a5c06e commit ad1151e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

db.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ int database_check(const struct su_context *ctx)
4444
fclose(fp);
4545
} else if ((fp = fopen(REQUESTOR_STORED_DEFAULT, "r"))) {
4646
LOGD("Using default file %s", REQUESTOR_STORED_DEFAULT);
47-
allow = fgetc(fp);
47+
char cmd[ARG_MAX];
48+
fgets(cmd, sizeof(cmd), fp);
49+
int last = strlen(cmd) - 1;
50+
if (last >= 0)
51+
cmd[last] = 0;
52+
53+
if (strcmp(cmd, "default") == 0) {
54+
allow = fgetc(fp);
55+
}
4856
fclose(fp);
4957
}
5058

0 commit comments

Comments
 (0)