Skip to content

Instantly share code, notes, and snippets.

@skreuzer
Last active July 31, 2017 01:37
Show Gist options
  • Save skreuzer/2fd0db9331290422c1f98b1291cbe40e to your computer and use it in GitHub Desktop.
Save skreuzer/2fd0db9331290422c1f98b1291cbe40e to your computer and use it in GitHub Desktop.
diff --git a/cf-agent/nfs.c b/cf-agent/nfs.c
index 1d0bc66..3ca3568 100644
--- a/cf-agent/nfs.c
+++ b/cf-agent/nfs.c
@@ -667,13 +667,23 @@ PromiseResult VerifyUnmount(EvalContext *ctx, char *name, Attributes a, const Pr
static int MatchFSInFstab(char *match)
{
Item *ip;
+ char delimit[]=" \t\r\n\v\f";
+ char *fstab_line, *token;
for (ip = FSTABLIST; ip != NULL; ip = ip->next)
{
- if (strstr(ip->name, match))
+ fstab_line = xstrdup(ip->name);
+ token = strtok(fstab_line, delimit);
+ while (token)
{
- return true;
+ if(strcmp(token, match) == 0)
+ {
+ free(fstab_line);
+ return true;
+ }
+ token = strtok(NULL, delimit);
}
+ free(fstab_line);
}
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment