summaryrefslogtreecommitdiff
path: root/math/calc/files/patch-lib_calc.c
blob: 241bead76932ef36aeece244c9de034624fe5af6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- lib_calc.c.orig	Mon Feb  7 22:08:08 2000
+++ lib_calc.c	Mon Feb  7 22:10:42 2000
@@ -407,9 +407,13 @@
 		if (ent == NULL) {
 			/* just assume . is home if all else fails */
 			home = ".";
+		} else {
+			home = (char *)malloc(strlen(ent->pw_dir)+1);
+			if (home == NULL)
+				home = ".";
+			else
+				strcpy(home, ent->pw_dir);
 		}
-		home = (char *)malloc(strlen(ent->pw_dir)+1);
-		strcpy(home, ent->pw_dir);
 	}
 
 	/* determine the $PAGER value */