We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca83500 commit 630f6e5Copy full SHA for 630f6e5
src/syscall/libc_wasip2.go
@@ -497,8 +497,33 @@ func symlink(from, to *byte) int32 {
497
//
498
//go:export fsync
499
func fsync(fd int32) int32 {
500
- return 0
+ if _, ok := wasiStreams[fd]; ok {
501
+ // can't sync a stream
502
+ libcErrno = EBADF
503
+ return -1
504
+ }
505
506
+ streams, ok := wasiFiles[fd]
507
+ if !ok {
508
509
510
511
+ if streams.d == cm.ResourceNone {
512
513
514
515
+ if streams.oflag&O_WRONLY == 0 {
516
517
518
519
+
520
+ result := streams.d.SyncData()
521
+ if err := result.Err(); err != nil {
522
+ libcErrno = errorCodeToErrno(*err)
523
524
525
526
+ return 0
527
}
528
529
// ssize_t readlink(const char *path, void *buf, size_t count);
0 commit comments