summaryrefslogtreecommitdiff
path: root/usr.bin/patch/util.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-07-31 20:51:44 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-07-31 20:51:44 +0000
commit526fe45812ae125bcc899def9b7ec5c7ff1b3118 (patch)
tree14601fde5ac13cc0723e843bb9b70fefed189426 /usr.bin/patch/util.c
parente8044ab2af2f30040de8b7da464c551850b7989d (diff)
Unbreak relative directory handling. Tweak from millert@
ok millert@
Diffstat (limited to 'usr.bin/patch/util.c')
-rw-r--r--usr.bin/patch/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 36f6e18e1d3..8b6014f47f3 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: util.c,v 1.23 2003/07/30 15:47:54 millert Exp $ */
+/* $OpenBSD: util.c,v 1.24 2003/07/31 20:51:43 otto Exp $ */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: util.c,v 1.23 2003/07/30 15:47:54 millert Exp $";
+static const char rcsid[] = "$OpenBSD: util.c,v 1.24 2003/07/31 20:51:43 otto Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -307,6 +307,7 @@ char *
fetchname(const char *at, int strip_leading, int assume_exists)
{
char *fullname, *name, *t, tmpbuf[200];
+ int sleading;
struct stat filestat;
if (at == NULL || *at == '\0')
@@ -323,9 +324,9 @@ fetchname(const char *at, int strip_leading, int assume_exists)
name = fullname = t = savestr(at);
/* Strip off up to `strip_leading' path components and NUL terminate. */
- for (; *t != '\0' && !isspace(*t); t++) {
+ for (sleading = strip_leading; *t != '\0' && !isspace(*t); t++) {
if (t[0] == '/' && t[1] != '/' && t[1] != '\0')
- if (--strip_leading >= 0)
+ if (--sleading >= 0)
name = t + 1;
}
*t = '\0';