Skip to content

Commit

Permalink
Strip trailing new lines from exec output
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jan 27, 2014
1 parent b5cc0e8 commit 023974a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/exec.c
Expand Up @@ -480,6 +480,12 @@ int radius_readfrom_program(REQUEST *request, int fd, pid_t pid, int timeout,
if (left <= 0) break;
}
#endif /* __MINGW32__ */

/* Strip trailing new lines */
while ((done > 0) && (answer[done - 1] == '\n')) {
answer[--done] = '\0';
}

return done;
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/keywords/update-exec
Expand Up @@ -16,7 +16,7 @@ update request {
Tmp-String-0 := `/bin/sh -c "echo 'foo bar baz'"`
}

if (Tmp-String-0 != "foo bar baz\n") {
if (Tmp-String-0 != "foo bar baz") {
update reply {
Filter-Id += "fail"
}
Expand Down

0 comments on commit 023974a

Please sign in to comment.