@@ -345,9 +345,7 @@ func (pd *pinDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
345
345
}
346
346
stream := pd .stream
347
347
if stream == nil {
348
- // TODO: We don't have an error kind
349
- // that translates into EBADF
350
- return nil , fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .IO )
348
+ return nil , fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .Closed )
351
349
}
352
350
var (
353
351
ctx = stream .Context
@@ -363,17 +361,15 @@ func (pd *pinDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
363
361
364
362
func (pd * pinDirectory ) StreamDir () <- chan filesystem.StreamDirEntry {
365
363
const op = "streamdir"
366
- stream := pd .stream
367
- if stream == nil {
368
- errs := make (chan filesystem.StreamDirEntry , 1 )
369
- // TODO: We don't have an error kind
370
- // that translates into EBADF
371
- errs <- newErrorEntry (
372
- fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .IO ),
373
- )
374
- return errs
364
+ if stream := pd .stream ; stream != nil {
365
+ return stream .ch
375
366
}
376
- return stream .ch
367
+ errs := make (chan filesystem.StreamDirEntry , 1 )
368
+ errs <- newErrorEntry (
369
+ fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .Closed ),
370
+ )
371
+ close (errs )
372
+ return errs
377
373
}
378
374
379
375
func (pd * pinDirectory ) Close () error {
@@ -383,9 +379,7 @@ func (pd *pinDirectory) Close() error {
383
379
pd .stream = nil
384
380
return nil
385
381
}
386
- // TODO: We don't have an error kind
387
- // that translates into EBADF
388
- return fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .IO )
382
+ return fserrors .New (op , filesystem .Root , fs .ErrClosed , fserrors .Closed )
389
383
}
390
384
391
385
func (pe * pinDirEntry ) Name () string {
0 commit comments