/[smeserver]/rpms/sudo/sme9/sudo-1.8.6p3-tty-parsing.patch
ViewVC logotype

Annotation of /rpms/sudo/sme9/sudo-1.8.6p3-tty-parsing.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Feb 4 19:44:46 2021 UTC (3 years, 4 months ago) by jpp
Branch: MAIN
CVS Tags: sudo-1_8_6p3-30_el6_sme, sudo-1_8_6p3-29_el6_9, HEAD
Sudo

1 jpp 1.1 diff -up sudo-1.8.6p7/src/ttyname.c.get_process_ttyname sudo-1.8.6p7/src/ttyname.c
2     --- sudo-1.8.6p7/src/ttyname.c.get_process_ttyname 2013-02-25 20:46:09.000000000 +0100
3     +++ sudo-1.8.6p7/src/ttyname.c 2017-05-25 10:23:28.720850944 +0200
4     @@ -171,6 +171,8 @@ static char *search_devs[] = {
5    
6     static char *ignore_devs[] = {
7     "/dev/fd/",
8     + "/dev/mqueue/",
9     + "/dev/shm/",
10     "/dev/stdin",
11     "/dev/stdout",
12     "/dev/stderr",
13     @@ -437,9 +439,13 @@ get_process_ttyname(void)
14     len = getline(&line, &linesize, fp);
15     fclose(fp);
16     if (len != -1) {
17     - /* Field 7 is the tty dev (0 if no tty) */
18     - char *cp = line;
19     - int field = 1;
20     + /*
21     + * Field 7 is the tty dev (0 if no tty).
22     + * Since the process name at field 2 "(comm)" may include spaces,
23     + * start at the last ')' found.
24     + */
25     + char *cp = strrchr(line, ')');
26     + int field = 2;
27     while (*cp != '\0') {
28     if (*cp++ == ' ') {
29     if (++field == 7) {

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed