summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler_process.cc')
-rw-r--r--winsup/cygwin/fhandler_process.cc7
1 files changed, 6 insertions, 1 deletions
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);