Be smarter about choosing which fd's to attach.
Be smarter about choosing which fd's to attach.

Instead of using readlink, stat() the child's file descriptors and
compare the result to the device in /proc/$pid/stat and /dev/tty. This
lets us properly attach a 'less' that is taking input from a pipe.

jerome-pouiller/reredirect,nelhage/reptyr,developerfm/reptyr,yatsek/reptyr,yatsek/reptyr,yatsek/reptyr,nelhage/reptyr,nelhage/reptyr,jerome-pouiller/reredirect,developerfm/reptyr,developerfm/reptyr