@@ -148,7 +148,14 @@ addToLibrary({
148148        blocks : stat . blocks 
149149      } ; 
150150    } , 
151-     setattr ( path ,  node ,  attr ,  chmod ,  utimes ,  truncate )  { 
151+     // Common code for both node and stream setattr 
152+     // For node getatrr: 
153+     //  - arg is a native path 
154+     //  - chmod, utimes, truncate are fs.chmodSync,  fs.utimesSync,  fs.truncateSync 
155+     // For stream getatrr: 
156+     //  - arg is a native file descriptor 
157+     //  - chmod, utimes, truncate are fs.fchmodSync, fs.futimesSync, fs.ftruncateSync 
158+     setattr ( arg ,  node ,  attr ,  chmod ,  utimes ,  truncate )  { 
152159      NODEFS . tryFSOperation ( ( )  =>  { 
153160        if  ( attr . mode  !==  undefined )  { 
154161          var  mode  =  attr . mode ; 
@@ -157,16 +164,16 @@ addToLibrary({
157164            // https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/chmod-wchmod 
158165            mode  &=  { { {  cDefs . S_IRUSR  |  cDefs . S_IWUSR  } } } ; 
159166          } 
160-           chmod ( path ,  mode ) ; 
167+           chmod ( arg ,  mode ) ; 
161168          // update the common node structure mode as well 
162169          node. mode  =  attr . mode ; 
163170        } 
164171        if  ( attr . timestamp  !==  undefined )  { 
165172          var  date  =  new  Date ( attr . timestamp ) ; 
166-           utimes ( path ,  date ,  date ) ; 
173+           utimes ( arg ,  date ,  date ) ; 
167174        } 
168175        if  ( attr . size  !==  undefined )  { 
169-           truncate ( path ,  attr . size ) ; 
176+           truncate ( arg ,  attr . size ) ; 
170177        } 
171178      } ) ; 
172179    } , 
0 commit comments