Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Towards safe mount #65
Conversation
zyga
added some commits
Jun 30, 2016
kyrofa
reviewed
Jun 30, 2016
| + * @len is the length of @dir (to avoid having to recalculate it). | ||
| +**/ | ||
| +static bool __attribute__ ((used)) | ||
| + is_subdir(const char *subdir, const char *dir, size_t len) |
kyrofa
Jun 30, 2016
Member
How to use this function is not obvious from its signature. You documented this (thank you), but perhaps it would be more clear to accept a length for both of these?
zyga
Jun 30, 2016
Collaborator
This function comes straight from upstream LXD codebase. I agree on the size being awkward to pass. The original code doesn't really take any advantage of this. I will change the method to compute both sizes by itself.
kyrofa
Jun 30, 2016
Member
I will change the method to compute both sizes by itself.
Yeah that's the ideal solution.
kyrofa
reviewed
Jun 30, 2016
| + // @dir can look like "path/" (that is, end with the directory separator). | ||
| + // When that is the case then given the test above we can be sure @subdir | ||
| + // is a real subdirectory. | ||
| + if (dirlen > 0 && dir[dirlen - 1] == '/') |
|
|
kyrofa
merged commit 938c748
into
master
Jun 30, 2016
zyga
deleted the
towards-safe-mount
branch
Jul 14, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zyga commentedJun 30, 2016
Just more functions and more tests