From af4a6c3a5619299a16cfbb545cde110849596204 Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 25 Aug 2003 01:10:51 +0000 Subject: - (bal) openbsd-compat/ OpenBSD updates. Mostly licensing, ansifications and minor fixes. --- openbsd-compat/realpath.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'openbsd-compat/realpath.c') diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c index 4286bde72..77da14e7c 100644 --- a/openbsd-compat/realpath.c +++ b/openbsd-compat/realpath.c @@ -35,7 +35,7 @@ #if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: realpath.c,v 1.9 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: realpath.c,v 1.10 2003/08/01 21:04:59 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -65,7 +65,7 @@ char * realpath(const char *path, char *resolved) { struct stat sb; - int fd, n, rootd, serrno = 0; + int fd, n, needslash, serrno = 0; char *p, *q, wbuf[MAXPATHLEN], start[MAXPATHLEN]; int symlinks = 0; @@ -141,16 +141,16 @@ loop: * happens if the last component is empty, or the dirname is root. */ if (resolved[0] == '/' && resolved[1] == '\0') - rootd = 1; + needslash = 0; else - rootd = 0; + needslash = 1; if (*wbuf) { - if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) { + if (strlen(resolved) + strlen(wbuf) + needslash >= MAXPATHLEN) { serrno = ENAMETOOLONG; goto err1; } - if (rootd == 0) + if (needslash == 0) strlcat(resolved, "/", MAXPATHLEN); strlcat(resolved, wbuf, MAXPATHLEN); } -- cgit v1.2.3