Ignore:
Timestamp:
2008-08-23T08:35:06Z (16 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c9f5e24f
Parents:
eb9618c
Message:

mkdir: Get rid of useless while loop (spaghetti)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    reb9618c r65267f6  
    148148
    149149        while (dirs[i] != NULL) {
    150                 /* Rewind to start of relative path */
    151                 while (!strcmp(dirs[i], "..")) {
     150                /* Sometimes make or scripts conjoin odd paths. Account for something
     151                 * like this: ../../foo/bar/../foo/foofoo/./bar */
     152                if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) {
    152153                        if (0 != (chdir(dirs[i]))) {
    153154                                cli_error(CL_EFAIL, "%s: impossible path: %s",
     
    156157                                goto finit;
    157158                        }
    158                         i++;
    159                 }
    160                 getcwd(wdp, PATH_MAX);
    161                 /* Sometimes make or scripts conjoin odd paths. Account for something
    162                  * like this: ../../foo/bar/../foo/foofoo/./bar */
    163                 if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) {
    164                         chdir(dirs[i]);
    165159                        getcwd(wdp, PATH_MAX);
    166160                } else {
Note: See TracChangeset for help on using the changeset viewer.