Use ssize_t for the return type of read/write instead of int.

This commit is contained in:
Ned T. Crigler 2012-07-01 21:26:10 +00:00
parent 637bafd129
commit aeb60e6d04
5 changed files with 2281 additions and 2840 deletions

View File

@ -217,7 +217,7 @@ attach_main(int noerror)
/* Pty activity */
if (n > 0 && FD_ISSET(s, &readfds))
{
int len = read(s, buf, sizeof(buf));
ssize_t len = read(s, buf, sizeof(buf));
if (len == 0)
{

View File

@ -111,6 +111,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@ -128,3 +131,6 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t

5100
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(dtach, 0.8, crigler@users.sourceforge.net)
AC_PREREQ(2.59)
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR(main.c)
AC_CONFIG_HEADER(config.h)
@ -25,6 +25,7 @@ AC_HEADER_TIME
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SSIZE_T
# Checks for library functions.
AC_TYPE_SIGNAL

View File

@ -220,7 +220,7 @@ static void
pty_activity(int s)
{
unsigned char buf[BUFSIZE];
int len;
ssize_t len;
struct client *p;
fd_set readfds, writefds;
int highest_fd, nclients;
@ -268,7 +268,7 @@ top:
/* Send the data out to the clients. */
for (p = clients, nclients = 0; p; p = p->next)
{
int written;
ssize_t written;
if (!FD_ISSET(p->fd, &writefds))
continue;
@ -276,7 +276,7 @@ top:
written = 0;
while (written < len)
{
int n = write(p->fd, buf + written, len - written);
ssize_t n = write(p->fd, buf + written, len - written);
if (n > 0)
{
@ -330,7 +330,7 @@ control_activity(int s)
static void
client_activity(struct client *p)
{
int len;
ssize_t len;
struct packet pkt;
/* Read the activity. */
@ -565,7 +565,7 @@ master_main(char **argv, int waitattach)
if (fd[0] != -1)
{
char buf[1024];
int len;
ssize_t len;
close(fd[1]);
len = read(fd[0], buf, sizeof(buf));