File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,11 @@ unsigned long nrand(unsigned long limit);
121
121
FAR char * lib_get_pathbuffer (void );
122
122
void lib_put_pathbuffer (FAR char * buffer );
123
123
124
+ /* Functions defined in lib_realpath.c **************************************/
125
+
126
+ FAR char * lib_realpath (FAR const char * path , FAR char * resolved ,
127
+ bool notfollow );
128
+
124
129
#undef EXTERN
125
130
#ifdef __cplusplus
126
131
}
Original file line number Diff line number Diff line change 36
36
* Public Functions
37
37
****************************************************************************/
38
38
39
- FAR char * realpath (FAR const char * path , FAR char * resolved )
39
+ FAR char * lib_realpath (FAR const char * path , FAR char * resolved ,
40
+ bool notfollow )
40
41
{
41
42
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
42
43
FAR char * wbuf [2 ] =
@@ -179,6 +180,13 @@ FAR char *realpath(FAR const char *path, FAR char *resolved)
179
180
memcpy (& p [1 ], path , q - path );
180
181
p [1 + q - path ] = '\0' ;
181
182
183
+ if (notfollow )
184
+ {
185
+ p += 1 + q - path ;
186
+ path = q ;
187
+ goto loop ;
188
+ }
189
+
182
190
/* If this component is a symlink, toss it and prepend link
183
191
* target to unresolved path.
184
192
*/
@@ -266,3 +274,8 @@ FAR char *realpath(FAR const char *path, FAR char *resolved)
266
274
267
275
return NULL ;
268
276
}
277
+
278
+ FAR char * realpath (FAR const char * path , FAR char * resolved )
279
+ {
280
+ return lib_realpath (path , resolved , false);
281
+ }
You can’t perform that action at this time.
0 commit comments