aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/sys/open.c')
-rw-r--r--com32/lib/sys/open.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/com32/lib/sys/open.c b/com32/lib/sys/open.c
index cb7c1b4d..3e7bb6cf 100644
--- a/com32/lib/sys/open.c
+++ b/com32/lib/sys/open.c
@@ -56,15 +56,17 @@ int open(const char *pathname, int flags, ...)
struct file_info *fp;
fd = opendev(&__file_dev, NULL, flags);
-
if (fd < 0)
return -1;
fp = &__file_info[fd];
handle = __com32.cs_pm->open_file(pathname, &fp->i.fd);
- if (handle < 0)
+ if (handle < 0) {
+ close(fd);
+ errno = ENOENT;
return -1;
+ }
fp->i.offset = 0;
fp->i.nbytes = 0;