ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtc.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtc.C (file contents):
Revision 1.23 by root, Wed Feb 1 18:07:18 2006 UTC vs.
Revision 1.27 by root, Fri Aug 18 23:03:31 2006 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*----------------------------------------------------------------------*
2 * File: rxvtc.C 2 * File: rxvtc.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
43 client (); 43 client ();
44}; 44};
45 45
46client::client () 46client::client ()
47{ 47{
48 sockaddr_un sa;
49 char *sockname = rxvt_connection::unix_sockname ();
50
51 if (strlen(sockname) >= sizeof(sa.sun_path))
52 {
53 fputs ("socket name too long, aborting.\n", stderr);
54 exit (STATUS_FAILURE);
55 }
56
48 if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) 57 if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
49 { 58 {
50 perror ("unable to create communications socket"); 59 perror ("unable to create communications socket");
51 exit (STATUS_FAILURE); 60 exit (STATUS_FAILURE);
52 } 61 }
53 62
54 char *sockname = rxvt_connection::unix_sockname ();
55 sockaddr_un sa;
56 sa.sun_family = AF_UNIX; 63 sa.sun_family = AF_UNIX;
57 strcpy (sa.sun_path, sockname); 64 strcpy (sa.sun_path, sockname);
58 free (sockname); 65 free (sockname);
59 66
60 if (connect (fd, (sockaddr *)&sa, sizeof (sa))) 67 if (connect (fd, (sockaddr *)&sa, sizeof (sa)))
73 { 80 {
74 sigset_t ss; 81 sigset_t ss;
75 82
76 sigemptyset (&ss); 83 sigemptyset (&ss);
77 sigaddset (&ss, SIGHUP); 84 sigaddset (&ss, SIGHUP);
85 sigaddset (&ss, SIGPIPE);
78 sigprocmask (SIG_BLOCK, &ss, 0); 86 sigprocmask (SIG_BLOCK, &ss, 0);
79 } 87 }
80 88
81 c.send ("NEW"); 89 c.send ("NEW");
82 90

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines