1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Made the file descriptor checks in the fsync() and fdatasync()

functions more robust.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14865 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-03-07 11:58:50 +00:00
parent a9c8cdc554
commit ef43011783
6 changed files with 53 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
/*
* $Id: unistd_sync_fd.c,v 1.3 2005-03-07 11:16:43 obarthel Exp $
* $Id: unistd_sync_fd.c,v 1.4 2005-03-07 11:58:50 obarthel Exp $
*
* :ts=4
*
@@ -47,13 +47,27 @@
/****************************************************************************/
void
int
__sync_fd(struct fd * fd,int mode)
{
int result = -1;
assert( fd != NULL );
__fd_lock(fd);
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
{
__set_errno(EINVAL);
goto out;
}
if(fd->fd_DefaultFile == ZERO)
{
__set_errno(EBADF);
goto out;
}
/* The mode tells us what to flush. 0 means "flush just the data", and
everything else means "flush everything. */
Flush(fd->fd_DefaultFile);
@@ -67,5 +81,11 @@ __sync_fd(struct fd * fd,int mode)
DoPkt(fh->fh_Type,ACTION_FLUSH, 0,0,0,0,0);
}
result = 0;
out:
__fd_unlock(fd);
return(result);
}