d3db425848
- merge contents of patch-ad and patch-an into patch-ad
42 lines
913 B
Plaintext
42 lines
913 B
Plaintext
--- icb/serverlist.c.orig Fri Feb 24 16:20:29 1995
|
|
+++ icb/serverlist.c Sun Jan 16 01:56:24 2000
|
|
@@ -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
|