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

Comparing rxvt-unicode/src/rxvtdaemon.C (file contents):
Revision 1.10 by root, Sun Dec 25 16:19:34 2005 UTC vs.
Revision 1.16 by sf-exg, Sun May 1 13:54:27 2011 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*----------------------------------------------------------------------*
2 * File: rxvtdaemon.C 2 * File: rxvtdaemon.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-2007 Marc Lehmann <schmorp@schmorp.de>
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.
27#include <inttypes.h> 27#include <inttypes.h>
28#include <unistd.h> 28#include <unistd.h>
29#include <errno.h> 29#include <errno.h>
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/utsname.h> 31#include <sys/utsname.h>
32#include <limits.h>
33 32
34#include "rxvtdaemon.h" 33#include "rxvtdaemon.h"
35 34
36char *rxvt_connection::unix_sockname () 35char *rxvt_connection::unix_sockname ()
37{ 36{
56 55
57void rxvt_connection::send (const char *data, int len) 56void rxvt_connection::send (const char *data, int len)
58{ 57{
59 uint8_t s[2]; 58 uint8_t s[2];
60 59
60 if (len > 65535)
61 len = 65535;
62
61 s[0] = len >> 8; s[1] = len; 63 s[0] = len >> 8; s[1] = len;
62 64
63 write (fd, s, 2); 65 write (fd, s, 2);
64 write (fd, data, len); 66 write (fd, data, len);
65} 67}
76 78
77 if (read (fd, s, 2) != 2) 79 if (read (fd, s, 2) != 2)
78 return false; 80 return false;
79 81
80 l = (s[0] << 8) + s[1]; 82 l = (s[0] << 8) + s[1];
81 if (l > 4096) 83 if (l > 65535)
82 return false; 84 return false;
83 85
84 if (len) 86 if (len)
85 *len = l; 87 *len = l;
86 88

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines