File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -151,12 +151,26 @@ static char *fsimplify_abs0 (char *fname, struct comp *parent)
151151 return fsimplify_abs0 (next + 1 , & comp );
152152}
153153
154+ static bool is_special_link (const char * name )
155+ {
156+ /* strcmp (comp.str, "..") || !strcmp (comp.str, ".") */
157+ if (name [0 ] != '.' )
158+ return false;
159+ if (name [1 ] == '\0' )
160+ return true;
161+ if (name [1 ] != '.' )
162+ return false;
163+ if (name [2 ] == '\0' )
164+ return true;
165+ return false;
166+ }
167+
154168extern char * canonicalizeAbsoluteFileName (char * fname )
155169{
156170 char * next = strchr (fname , '/' );
157171 if (next == NULL )
158172 {
159- if (! strcmp (fname , ".." ) || ! strcmp ( fname , "." ))
173+ if (is_special_link (fname ))
160174 {
161175 fname [0 ] = '/' ;
162176 fname [1 ] = '\0' ;
@@ -175,7 +189,7 @@ extern char *canonicalizeAbsoluteFileName (char *fname)
175189 .parent = NULL ,
176190 .child = NULL
177191 };
178- if (! strcmp (comp .str , ".." ) || ! strcmp ( comp . str , "." ))
192+ if (is_special_link (comp .str ))
179193 {
180194 comp .str [0 ] = '\0' ;
181195 comp .len = 0 ;
You can’t perform that action at this time.
0 commit comments