Skip to content

Commit 07e4993

Browse files
committed
FOpen return Fix
1 parent cb0f329 commit 07e4993

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

directory_filesystem.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"io"
77
"io/ioutil"
8-
"log"
98
"net/http"
109
"os"
1110
"path/filepath"
@@ -114,12 +113,12 @@ func FClose(file *os.File) error {
114113
// Original : https://www.php.net/manual/en/function.fopen.php
115114
// fopen() binds a named resource, specified by filename, to a stream.
116115
// Mode : os.O_RDONLY | os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_EXCL | os.O_SYNC | os.O_TRUNC
117-
func FOpen(file string, mode int) (f *os.File) {
116+
func FOpen(file string, mode int) (*os.File, error) {
118117
f, err := os.OpenFile(file, mode, 0644)
119118
if err != nil {
120-
log.Fatal(err)
119+
return f,err
121120
}
122-
return f
121+
return f,err
123122
}
124123

125124
// FRead - Binary-safe file read.

0 commit comments

Comments
 (0)