42 lines
922 B
Plaintext
42 lines
922 B
Plaintext
--- icb/serverlist.c.~1~ Fri Feb 24 13:20:29 1995
|
|
+++ icb/serverlist.c Wed Jul 15 15:09:58 1998
|
|
@@ -1,4 +1,5 @@
|
|
#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include "icb.h"
|
|
@@ -16,7 +17,8 @@
|
|
struct stat statbuf;
|
|
char *personalsl;
|
|
char command[256];
|
|
- char pwd[256];
|
|
+ char pwd[MAXPATHLEN];
|
|
+ char * home;
|
|
FILE *ret;
|
|
|
|
#ifdef sgi
|
|
@@ -25,15 +27,19 @@
|
|
#ifndef SYSV
|
|
getwd(pwd);
|
|
#else /* SYSV */
|
|
- getcwd(pwd, MAXPATHLEN+1);
|
|
+ getcwd(pwd, MAXPATHLEN);
|
|
#endif /* SYSV */
|
|
#ifdef sgi
|
|
#define SYSV
|
|
#endif
|
|
- chdir(getenv("HOME"));
|
|
+ home = getenv( "HOME" );
|
|
+ if ( ! home )
|
|
+ errx( 1, "can't get home directory from env" );
|
|
+ chdir( home );
|
|
if (!stat(PERSONALSL,&statbuf))
|
|
{
|
|
- sprintf(command,"/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
|
|
+ snprintf(command, sizeof command, "/bin/cat %s %s\n",
|
|
+ PERSONALSL, SERVERLIST);
|
|
ret= popen(command,"r");
|
|
}
|
|
else
|