| Ticket UUID: | 0ac9d06895f000b3c83fcb6b14940acc79f11122 | ||
| Title: | Don't call getsockname(2) in Tcl_MakeFileChannel(3) unless absolutely necessary | ||
| Type: | RFE | Created on: | 2018-06-07 06:25:47 |
| Submitter: | stu | Assigned to: | nobody |
| Subsystem: | 25. Channel System | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2018-06-13 16:20:03 |
| Status: | Closed | Closed by: | stu |
| Resolution: | Accepted | Closed on: | 2018-06-13 16:20:03 |
| Version: | 8.6.* | ||
| Description: | ||||
|
Tcl_MakeFileChannel(3) checks if the given fd is a tty or a socket before assuming it's a file.
#include <unistd.h>
#define TCLSH "/usr/local/bin/tclsh"
int main (int argc, char *argv[]) {
char *a[] = { TCLSH, NULL };
char *e[] = { NULL };
#ifdef DNS
pledge(NULL, "stdio rpath getpw dns");
#else
# ifdef INET
pledge(NULL, "stdio rpath getpw inet");
# else
pledge(NULL, "stdio rpath getpw");
# endif
#endif
execve(TCLSH, a, e);
return 0;
}
Build with no -D's:
$ cc -o tpl tpl.c $ echo 'puts moo' | ./tpl Abort trap (core dumped)Build with either -DINET or -DDNS: $ cc -o tpl tpl.c -DINET $ echo 'puts moo' | ./tpl moo | ||||
| User Comments: | ||||
stu added on 2018-06-13 16:18:24:
Closed by [a23a536a48]. stu added on 2018-06-13 16:20:03:
[a23a536a48e68141] | ||||
Attachments:
- patch-unix_tclUnixChan_c [download] added by stu on 2018-06-07 06:27:08. [details]
