summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-22 22:24:52 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-22 22:24:52 +0000
commita1af50e492a0fe75c1d06ee538abb365947fb218 (patch)
treea7a2100c944ccfdda0a9e30241ed8e972ef1a600 /usr.bin/make/parse.c
parentdceae2c8b9b6e9a2e7437fd943b4cdc48dc409cc (diff)
From NetBSD:
Support SVR4 style archives. Fix pr/1421 (from Matthew Green) and pr/1997 (from Jeff Thieleke). In ParseDoInclude(), make a temporary copy of the current file name while searching for ""-type include files, since the current file name might not be a writeable string.
Diffstat (limited to 'usr.bin/make/parse.c')
-rw-r--r--usr.bin/make/parse.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index d654157ef5d..785fad21dff 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.18 1995/12/16 05:03:13 christos Exp $ */
+/* $NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 5.18 (Berkeley) 2/19/91";
#else
-static char rcsid[] = "$NetBSD: parse.c,v 1.18 1995/12/16 05:03:13 christos Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.19 1996/02/07 23:04:04 thorpej Exp $";
#endif
#endif /* not lint */
@@ -1728,9 +1728,12 @@ ParseDoInclude (file)
* leading path components and call Dir_FindFile to see if
* we can locate the beast.
*/
- char *prefEnd;
+ char *prefEnd, *Fname;
- prefEnd = strrchr (fname, '/');
+ /* Make a temporary copy of this, to be safe. */
+ Fname = strdup(fname);
+
+ prefEnd = strrchr (Fname, '/');
if (prefEnd != (char *)NULL) {
char *newName;
@@ -1738,7 +1741,7 @@ ParseDoInclude (file)
if (file[0] == '/')
newName = strdup(file);
else
- newName = str_concat (fname, file, STR_ADDSLASH);
+ newName = str_concat (Fname, file, STR_ADDSLASH);
fullname = Dir_FindFile (newName, parseIncPath);
if (fullname == (char *)NULL) {
fullname = Dir_FindFile(newName, dirSearchPath);
@@ -1748,6 +1751,7 @@ ParseDoInclude (file)
} else {
fullname = (char *)NULL;
}
+ free (Fname);
} else {
fullname = (char *)NULL;
}