File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -895,7 +895,7 @@ FS.staticInit();
895895 }
896896#endif
897897 } ,
898- readlink ( path ) {
898+ readlink( path , opts = { } ) {
899899 var lookup = FS . lookupPath ( path ) ;
900900 var link = lookup . node ;
901901 if ( ! link ) {
@@ -904,7 +904,11 @@ FS.staticInit();
904904 if ( ! link . node_ops . readlink ) {
905905 throw new FS . ErrnoError ( { { { cDefs . EINVAL } } } ) ;
906906 }
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 ) ;
908912 } ,
909913 stat ( path , dontFollow ) {
910914 var lookup = FS . lookupPath ( path , { follow : ! dontFollow } ) ;
Original file line number Diff line number Diff line change @@ -919,7 +919,7 @@ var SyscallsLibrary = {
919919 path = SYSCALLS . getStr ( path ) ;
920920 path = SYSCALLS . calculateAt ( dirfd , path ) ;
921921 if ( bufsize <= 0 ) return - { { { cDefs . EINVAL } } } ;
922- var ret = FS . readlink ( path ) ;
922+ var ret = FS . readlink ( path , { noResolve : true } ) ;
923923
924924 var len = Math . min ( bufsize , lengthBytesUTF8 ( ret ) ) ;
925925 var endChar = HEAP8 [ buf + len ] ;
You can’t perform that action at this time.
0 commit comments