static int talktochild(int master, char *seq) { int count = 0; fstring issue, expected; fstrcpy(issue, "."); while (next_token(&seq, expected, NULL, sizeof(expected))) { pwd_sub(expected); count++; if (!expect(master, issue, expected)) { DEBUG(3,("Response %d incorrect\n", count)); return False; } if (!next_token(&seq, issue, NULL, sizeof(issue))) fstrcpy(issue, "."); pwd_sub(issue); } return (count > 0); }
static int talktochild(int master, const char *seq) { TALLOC_CTX *frame = talloc_stackframe(); int count = 0; char *issue; char *expected; issue = talloc_strdup(frame, "."); if (!issue) { TALLOC_FREE(frame); return false; } while (next_token_talloc(frame, &seq, &expected, NULL)) { pwd_sub(expected); count++; if (!expect(master, issue, expected)) { DEBUG(3, ("Response %d incorrect\n", count)); TALLOC_FREE(frame); return false; } if (!next_token_talloc(frame, &seq, &issue, NULL)) { issue = talloc_strdup(frame, "."); if (!issue) { TALLOC_FREE(frame); return false; } } pwd_sub(issue); } if (!strequal(issue, ".")) { /* we have one final issue to send */ expected = talloc_strdup(frame, "."); if (!expected) { TALLOC_FREE(frame); return false; } if (!expect(master, issue, expected)) { TALLOC_FREE(frame); return False; } } TALLOC_FREE(frame); return (count > 0); }