[Python-checkins] bpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557)

Miss Islington (bot) webhook-mailer at python.org
Tue Jan 14 12:57:09 EST 2020


https://github.com/python/cpython/commit/f04750bb7af45cb6efab8d92d1ff063f0bf2833d
commit: f04750bb7af45cb6efab8d92d1ff063f0bf2833d
branch: master
author: Václav Bartoš <bartos at cesnet.cz>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2020-01-14T09:57:04-08:00
summary:

bpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557)



The default value of "ident" parameter should be sys.argv[0] with leading path
components stripped, but it contained the last slash, i.e. '/program' instead
of 'program'.

BPO issue: https://bugs.python.org/issue38361


https://bugs.python.org/issue38361

files:
A Misc/NEWS.d/next/Library/2019-10-04-09-49-56.bpo-38361.LM4u4T.rst
M Modules/syslogmodule.c

diff --git a/Misc/NEWS.d/next/Library/2019-10-04-09-49-56.bpo-38361.LM4u4T.rst b/Misc/NEWS.d/next/Library/2019-10-04-09-49-56.bpo-38361.LM4u4T.rst
new file mode 100644
index 0000000000000..65186db60b455
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-10-04-09-49-56.bpo-38361.LM4u4T.rst
@@ -0,0 +1 @@
+Fixed an issue where ``ident`` could include a leading path separator when :func:`syslog.openlog` was called without arguments.
\ No newline at end of file
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index b2ea73baa1be4..539224f2c5b67 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -99,7 +99,7 @@ syslog_get_argv(void)
     if (slash == -2)
         return NULL;
     if (slash != -1) {
-        return PyUnicode_Substring(scriptobj, slash, scriptlen);
+        return PyUnicode_Substring(scriptobj, slash + 1, scriptlen);
     } else {
         Py_INCREF(scriptobj);
         return(scriptobj);



More information about the Python-checkins mailing list