File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -895,7 +895,7 @@ FS.staticInit();
895
895
}
896
896
#endif
897
897
} ,
898
- readlink ( path ) {
898
+ readlink( path , opts = { } ) {
899
899
var lookup = FS . lookupPath ( path ) ;
900
900
var link = lookup . node ;
901
901
if ( ! link ) {
@@ -904,7 +904,11 @@ FS.staticInit();
904
904
if ( ! link . node_ops . readlink ) {
905
905
throw new FS . ErrnoError ( { { { cDefs . EINVAL } } } ) ;
906
906
}
907
- return PATH_FS . resolve ( FS . getPath ( link . parent ) , link . node_ops . readlink ( link ) ) ;
907
+ const target = link . node_ops . readlink ( link ) ;
908
+ if ( opts . noResolve ) {
909
+ return target ;
910
+ }
911
+ return PATH_FS . resolve ( FS . getPath ( link . parent ) , target ) ;
908
912
} ,
909
913
stat ( path , dontFollow ) {
910
914
var lookup = FS . lookupPath ( path , { follow : ! dontFollow } ) ;
Original file line number Diff line number Diff line change @@ -919,7 +919,7 @@ var SyscallsLibrary = {
919
919
path = SYSCALLS . getStr ( path ) ;
920
920
path = SYSCALLS . calculateAt ( dirfd , path ) ;
921
921
if ( bufsize <= 0 ) return - { { { cDefs . EINVAL } } } ;
922
- var ret = FS . readlink ( path ) ;
922
+ var ret = FS . readlink ( path , { noResolve : true } ) ;
923
923
924
924
var len = Math . min ( bufsize , lengthBytesUTF8 ( ret ) ) ;
925
925
var endChar = HEAP8 [ buf + len ] ;
You can’t perform that action at this time.
0 commit comments