diff options
author | hpa <hpa> | 2004-11-17 05:52:45 +0000 |
---|---|---|
committer | hpa <hpa> | 2004-11-17 05:52:45 +0000 |
commit | 8aada67545460566c9be6a3e021260509e8edaee (patch) | |
tree | 443a4442dc20031c8d42229a7c5b9e2ba2f33aae /com32/lib/sys/close.c | |
parent | 17f967640cef484f83d755c9dd016a946711236f (diff) | |
download | syslinux-8aada67545460566c9be6a3e021260509e8edaee.tar.gz |
Very basic operations now work; need to handle line-oriented
versus character-oriented input
Diffstat (limited to 'com32/lib/sys/close.c')
-rw-r--r-- | com32/lib/sys/close.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/com32/lib/sys/close.c b/com32/lib/sys/close.c index b81d77ef..7af7ff13 100644 --- a/com32/lib/sys/close.c +++ b/com32/lib/sys/close.c @@ -37,21 +37,20 @@ int close(int fd) { - com32sys_t regs; struct file_info *fp = &__file_info[fd]; + int rv = 0; - if ( fd >= NFILES || fp->blocklg2 == 0 ) { + if ( fd >= NFILES || !fp->ops ) { errno = EBADF; return -1; } - if ( fp->filedes ) { - memset(®s, 0, sizeof regs); - regs.eax.w[0] = 0x0008; /* Close file */ - regs.esi.w[0] = fp->filedes; - - __com32.cs_intcall(0x22, ®s, NULL); + if ( fp->ops->close ) { + rv = fp->ops->close(fp); + if ( rv ) + return rv; } + fp->ops = NULL; /* File structure unused */ return 0; } |