1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00

Fix truncated command names in process-attributes under Macos

* src/sysdep.c (system_process_attributes): Fix truncation of
command names in process-attributes under Macos (bug#36287).
This commit is contained in:
Robert Pluim 2020-08-18 20:31:37 +02:00 committed by Lars Ingebrigtsen
parent c70b5e8ad0
commit b4f05274c7

View File

@ -53,6 +53,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
# include <sys/sysctl.h>
#endif
#ifdef DARWIN_OS
# include <libproc.h>
#endif
#ifdef __FreeBSD__
/* Sparc/ARM machine/frame.h has 'struct frame' which conflicts with Emacs's
'struct frame', so rename it. */
@ -3871,8 +3875,21 @@ system_process_attributes (Lisp_Object pid)
if (gr)
attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
char *comm;
if (proc_pidpath (proc_id, pathbuf, sizeof(pathbuf)) > 0)
{
if ((comm = strrchr (pathbuf, '/')))
comm++;
else
comm = pathbuf;
}
else
comm = proc.kp_proc.p_comm;
decoded_comm = (code_convert_string_norecord
(build_unibyte_string (proc.kp_proc.p_comm),
(build_unibyte_string (comm),
Vlocale_coding_system, 0));
attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs);