--- rxvt-unicode/src/rxvtdaemon.C 2005/12/25 15:30:29 1.9 +++ rxvt-unicode/src/rxvtdaemon.C 2006/02/20 22:42:00 1.13 @@ -1,9 +1,9 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: rxvtdaemon.C *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2003-2004 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,19 +33,6 @@ #include "rxvtdaemon.h" -// works around linux kernel bug, returns EAGAIN on a blocking socket -static ssize_t -read_ (int fd, void *buf, size_t count) -{ - int ret; - - do - ret = read (fd, buf, count); - while (ret < 0 && errno == EAGAIN); - - return ret; -} - char *rxvt_connection::unix_sockname () { char name[PATH_MAX]; @@ -71,6 +58,9 @@ { uint8_t s[2]; + if (len > 65535) + len = 65535; + s[0] = len >> 8; s[1] = len; write (fd, s, 2); @@ -87,11 +77,11 @@ uint8_t s[2]; int l; - if (read_ (fd, s, 2) != 2) + if (read (fd, s, 2) != 2) return false; l = (s[0] << 8) + s[1]; - if (l > 4096) + if (l > 65535) return false; if (len) @@ -102,7 +92,7 @@ if (!data) return false; - if (read_ (fd, data, l) != l) + if (read (fd, data, l) != l) return false; data[l] = 0; @@ -123,7 +113,7 @@ { uint8_t s[4]; - if (read_ (fd, s, 4) != 4) + if (read (fd, s, 4) != 4) return false; data = (((((s[0] << 8) | s[1]) << 8) | s[2]) << 8) | s[3];