PolicyKit: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 5 12:59:54 UTC 2023


 src/polkitagent/polkitagentsession.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7b3c9c85980f2f6a521aac97089c99647b4cf4ce
Author: Vincent Mihalkovic <vmihalko at redhat.com>
Date:   Wed Apr 5 12:59:51 2023 +0000

    polkitagentsession: Fix the tautological check for add_newline

diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c
index 895d75e..491d9dc 100644
--- a/src/polkitagent/polkitagentsession.c
+++ b/src/polkitagent/polkitagentsession.c
@@ -540,7 +540,7 @@ polkit_agent_session_response (PolkitAgentSession *session,
 
   response_len = strlen (response);
 
-  add_newline = (response[response_len] != '\n');
+  add_newline = (response_len == 0 || response[response_len - 1] != '\n');
 
   (void) g_output_stream_write_all (session->child_stdin, response, response_len, NULL, NULL, NULL);
   if (add_newline)


More information about the hal-commit mailing list