--- rxvt-unicode/src/rxvtc.C 2006/02/20 22:40:35 1.24 +++ rxvt-unicode/src/rxvtc.C 2007/11/18 00:17:20 1.29 @@ -1,4 +1,4 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: rxvtc.C *----------------------------------------------------------------------* * @@ -39,20 +39,28 @@ #define STATUS_FAILURE 1 #define STATUS_CONNECTION_FAILED 2 -struct client : rxvt_connection { +struct client : rxvt_connection +{ client (); }; client::client () { + sockaddr_un sa; + char *sockname = rxvt_connection::unix_sockname (); + + if (strlen(sockname) >= sizeof(sa.sun_path)) + { + fputs ("socket name too long, aborting.\n", stderr); + exit (STATUS_FAILURE); + } + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { perror ("unable to create communications socket"); exit (STATUS_FAILURE); } - char *sockname = rxvt_connection::unix_sockname (); - sockaddr_un sa; sa.sun_family = AF_UNIX; strcpy (sa.sun_path, sockname); free (sockname); @@ -75,6 +83,7 @@ sigemptyset (&ss); sigaddset (&ss, SIGHUP); + sigaddset (&ss, SIGPIPE); sigprocmask (SIG_BLOCK, &ss, 0); }