summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-12-07 13:52:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-12-07 13:52:18 +0000
commitae7de1f80984fa529a0be2a1f8f153edf1dd728b (patch)
tree7d65161b7e27b3db89f7dca4d50504d4152b431e
parent27183faed3811da42dfbe8c60d9029e1e10ddd75 (diff)
make sure we always nul-terminate
problem spotted by jsg@ reorg so that the nul termination is obvious.
-rw-r--r--usr.bin/make/targequiv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/make/targequiv.c b/usr.bin/make/targequiv.c
index ccd0ecc9b6a..9acf80ec6bc 100644
--- a/usr.bin/make/targequiv.c
+++ b/usr.bin/make/targequiv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: targequiv.c,v 1.5 2014/05/12 19:11:19 espie Exp $ */
+/* $OpenBSD: targequiv.c,v 1.6 2014/12/07 13:52:17 espie Exp $ */
/*
* Copyright (c) 2007-2008 Marc Espie.
*
@@ -221,8 +221,10 @@ parse_reduce(size_t i, const char *src)
}
buffer[i++] = *src++;
}
- buffer[i++] = *src;
+ if (src[0] == '/')
+ buffer[i++] = *src++;
}
+ buffer[i++] = 0;
return i;
}