From 340854dda878cb615c5c6c512a59a871d757cec1 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 16 Oct 2013 15:14:22 +0000 Subject: [PATCH] * fhandler_process.cc (format_process_ctty): Fix random content of /proc/$PID/ctty if the process has no controlling tty. Set to just "\n" instead. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/fhandler_process.cc | 7 ++++++- winsup/cygwin/release/1.7.26 | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6b20881be..3e46685bb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2013-10-16 Corinna Vinschen + + * fhandler_process.cc (format_process_ctty): Fix random content of + /proc/$PID/ctty if the process has no controlling tty. Set to just + "\n" instead. + 2013-10-15 Corinna Vinschen * autoload.cc (CryptAcquireContextW): Remove. diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 044757d74..8776702a6 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -433,8 +433,13 @@ format_process_gid (void *data, char *&destbuf) static off_t format_process_ctty (void *data, char *&destbuf) { - device d; _pinfo *p = (_pinfo *) data; + if (p->ctty < 0) + { + destbuf = (char *) crealloc_abort (destbuf, 2); + return __small_sprintf (destbuf, "\n"); + } + device d; d.parse (p->ctty); destbuf = (char *) crealloc_abort (destbuf, strlen (d.name) + 2); return __small_sprintf (destbuf, "%s\n", d.name); diff --git a/winsup/cygwin/release/1.7.26 b/winsup/cygwin/release/1.7.26 index ef21b6901..8f15405bd 100644 --- a/winsup/cygwin/release/1.7.26 +++ b/winsup/cygwin/release/1.7.26 @@ -15,3 +15,6 @@ Bug fixes: - 64 bit only: Correctly mmap'ing regions > 4 Gigs. Fixes: http://cygwin.com/ml/cygwin/2013-09/msg00155.html + +- Fix random content of /proc/$PID/ctty if the process has no controlling + tty. Set to just "\n" instead.