summaryrefslogtreecommitdiff
path: root/debian/patches/use-proc-self-consistently-on-linux.diff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-06-21 14:19:45 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-06-21 14:19:45 +0300
commit546742e5e8544fb42aa65744d719100b5e32dee4 (patch)
tree2d3ccd186b8ccb02cd134af845cc41aa04e1ff00 /debian/patches/use-proc-self-consistently-on-linux.diff
downloadsudo-debian.tar.gz
Imported sudo 1.8.19p1-2.1debian/1.8.19p1-2.1debian
Diffstat (limited to 'debian/patches/use-proc-self-consistently-on-linux.diff')
-rw-r--r--debian/patches/use-proc-self-consistently-on-linux.diff33
1 files changed, 33 insertions, 0 deletions
diff --git a/debian/patches/use-proc-self-consistently-on-linux.diff b/debian/patches/use-proc-self-consistently-on-linux.diff
new file mode 100644
index 0000000..944830f
--- /dev/null
+++ b/debian/patches/use-proc-self-consistently-on-linux.diff
@@ -0,0 +1,33 @@
+
+# HG changeset patch
+# User Todd C. Miller <Todd.Miller@courtesan.com>
+# Date 1496162651 21600
+# Node ID 6f3d9816541ba84055ae5aec6ff9d9523c2a96f3
+# Parent 98ef2ef47aba10f6b83904dca4d446c4b8f24987
+Use /proc/self consistently on Linux. As far as I know, only AIX
+doesn't support /proc/self.
+
+diff -r 98ef2ef47aba -r 6f3d9816541b src/ttyname.c
+--- a/src/ttyname.c Mon May 29 14:36:35 2017 -0600
++++ b/src/ttyname.c Tue May 30 10:44:11 2017 -0600
+@@ -451,7 +451,8 @@
+ char *
+ get_process_ttyname(char *name, size_t namelen)
+ {
+- char path[PATH_MAX], *line = NULL;
++ const char path[] = "/proc/self/stat";
++ char *line = NULL;
+ char *ret = NULL;
+ size_t linesize = 0;
+ int serrno = errno;
+@@ -459,8 +460,7 @@
+ FILE *fp;
+ debug_decl(get_process_ttyname, SUDO_DEBUG_UTIL)
+
+- /* Try to determine the tty from tty_nr in /proc/pid/stat. */
+- snprintf(path, sizeof(path), "/proc/%u/stat", (unsigned int)getpid());
++ /* Try to determine the tty from tty_nr in /proc/self/stat. */
+ if ((fp = fopen(path, "r")) != NULL) {
+ len = getline(&line, &linesize, fp);
+ fclose(fp);
+