]> git.ipfire.org Git - pakfire.git/commitdiff
_pakfire: Remove the trailing newline before passing to python
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Mar 2021 22:03:21 +0000 (22:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Mar 2021 22:03:21 +0000 (22:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c

index dd568bfd76394f91319178acb04550f837bef030..db2e0761a44570c2f15235be279e35f6203ce465 100644 (file)
@@ -390,8 +390,12 @@ static int __Pakfire_execute_logging_callback(Pakfire pakfire, void* data,
                        break;
        }
 
+       // Remove the trailing newline
+       while (line && line[length - 1] == '\n')
+               length--;
+
        // Create tuple with arguments for the callback function
-       PyObject* args = Py_BuildValue("(is)", priority, line);
+       PyObject* args = Py_BuildValue("(is#)", priority, line, length);
        if (!args)
                return 1;