--- ray/src/util/netproc.c 1997/10/28 14:01:39 2.8 +++ ray/src/util/netproc.c 2003/06/30 14:59:13 2.11 @@ -1,9 +1,6 @@ -/* Copyright (c) 1996 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: netproc.c,v 2.11 2003/06/30 14:59:13 schorsch Exp $"; #endif - /* * Parallel network process handling routines */ @@ -11,6 +8,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include #include #include +#include + #include "selcall.h" #include "netproc.h" #include "paths.h" @@ -21,7 +20,7 @@ PSERVER *pslist = NULL; /* global process server list static PROC *pindex[FD_SETSIZE]; /* process index table */ static char ourhost[64]; /* this host name */ -static char ourdir[MAXPATH]; /* our working directory */ +static char ourdir[PATH_MAX]; /* our working directory */ static char ouruser[32]; /* our user name */ static char *ourshell; /* our user's shell */ @@ -30,7 +29,6 @@ static int maxfd; /* maximum assigned descriptor */ extern char *remsh; /* externally defined remote shell program */ -extern char *malloc(), *realloc(); extern char *getenv(); @@ -47,12 +45,12 @@ int np; if (ps == NULL) return(NULL); if (!ourhost[0]) { /* initialize */ - char dirtmp[MAXPATH]; + char dirtmp[PATH_MAX]; register char *cp; register int len; strcpy(ourhost, myhostname()); - getwd(dirtmp); + getcwd(dirtmp, sizeof(dirtmp)); if ((cp = getenv("HOME")) != NULL) { if (!strcmp(cp, dirtmp)) ourdir[0] = '\0'; @@ -126,7 +124,7 @@ PSERVER *ps; /* remove server from list */ psp->next = ps->next; pslist = pstart.next; - free((char *)ps); /* free associated memory */ + free((void *)ps); /* free associated memory */ } @@ -153,7 +151,7 @@ register PSERVER *ps; char *command; int (*compf)(); { - char udirt[MAXPATH]; + char udirt[PATH_MAX]; char *av[16]; int pfd[2], pid; register int i; @@ -249,7 +247,7 @@ int fd; if (pp->elen == 0) pp->errs = (char *)malloc(nr+1); else - pp->errs = (char *)realloc(pp->errs, pp->elen+nr+1); + pp->errs = (char *)realloc((void *)pp->errs, pp->elen+nr+1); if (pp->errs == NULL) { perror("malloc failed"); exit(1); @@ -296,7 +294,7 @@ int status; close(pp->efd); /* close error stream */ pindex[pp->efd] = NULL; FD_CLR(pp->efd, &errdesc); - free((char *)pp->errs); + free((void *)pp->errs); pp->com = NULL; /* clear settings */ pp->pid = -1; pp->efd = -1;