summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%google.com <devnull@localhost>2007-09-01 05:36:33 +0000
committerwtc%google.com <devnull@localhost>2007-09-01 05:36:33 +0000
commit13667d0695b8fcd6615b856f4eccf4439c9d5f41 (patch)
tree6793d858d3988d189c2969b667402237c1458014
parent775e03ad29c1e75d149eb876e843a887690026d1 (diff)
downloadnspr-hg-13667d0695b8fcd6615b856f4eccf4439c9d5f41.tar.gz
Bug 392722: fixed the bug that nsinstall chokes on double slashes in path.
The patch is contributed by Fabien Tassin <fta+bugzilla@sofaraway.org>. r=wtc.
-rw-r--r--config/nsinstall.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/config/nsinstall.c b/config/nsinstall.c
index e9f1aebd..80d907ed 100644
--- a/config/nsinstall.c
+++ b/config/nsinstall.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -135,8 +135,8 @@ mkdirs(char *path, mode_t mode)
while (*path == '/' && path[1] == '/')
path++;
- while ((cp = strrchr(path, '/')) && cp[1] == '\0')
- *cp = '\0';
+ for (cp = strrchr(path, '/'); cp && cp != path && cp[-1] == '/'; cp--)
+ ;
if (cp && cp != path) {
*cp = '\0';
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&