diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2024-01-11 23:21:54 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2024-01-12 17:01:04 +0000 |
commit | d9494352c571d332cf92bdadcd898894f0af12df (patch) | |
tree | ef1b99c51a3b7d3f8fdcb87803fe957f95a7dafc /modules/pam_exec | |
parent | cf80332ddb98c109c5abc35c74d6dd371ca7fa5b (diff) | |
download | pam-d9494352c571d332cf92bdadcd898894f0af12df.tar.gz pam-d9494352c571d332cf92bdadcd898894f0af12df.tar.bz2 pam-d9494352c571d332cf92bdadcd898894f0af12df.zip |
modules: simplify newline removal
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules/pam_exec')
-rw-r--r-- | modules/pam_exec/pam_exec.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c index 653fe3aa..5468e179 100644 --- a/modules/pam_exec/pam_exec.c +++ b/modules/pam_exec/pam_exec.c @@ -273,10 +273,7 @@ call_exec (const char *pam_type, pam_handle_t *pamh, close(stdout_fds[1]); while (getline(&buf, &n, stdout_file) != -1) { - size_t len; - len = strlen(buf); - if (len > 0 && buf[len-1] == '\n') - buf[len-1] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; pam_info(pamh, "%s", buf); } free(buf); |