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.


git-svn-id: svn://10.0.0.236/trunk@233540 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%google.com 2007-09-01 05:36:33 +00:00
parent 1fcdb15fc7
commit b81f3bd5b7

View File

@ -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 ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
@ -135,8 +135,8 @@ mkdirs(char *path, mode_t mode)
while (*path == '/' && path[1] == '/') while (*path == '/' && path[1] == '/')
path++; path++;
while ((cp = strrchr(path, '/')) && cp[1] == '\0') for (cp = strrchr(path, '/'); cp && cp != path && cp[-1] == '/'; cp--)
*cp = '\0'; ;
if (cp && cp != path) { if (cp && cp != path) {
*cp = '\0'; *cp = '\0';
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) && if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&