mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- The thread-safe version of isatty() should now work for stdio
file descriptors, too. - Retrofitted thread-safety into the termios code. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15010 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_lseek.c,v 1.9 2005-04-24 09:53:11 obarthel Exp $
|
||||
* $Id: fcntl_lseek.c,v 1.10 2005-07-06 18:48:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@@ -46,8 +46,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
{
|
||||
struct file_action_message fam;
|
||||
off_t result = SEEK_ERROR;
|
||||
struct fd * fd = NULL;
|
||||
off_t position;
|
||||
struct fd * fd;
|
||||
|
||||
ENTER();
|
||||
|
||||
@@ -62,6 +62,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__stdio_lock();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
@@ -69,6 +71,8 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
goto out;
|
||||
}
|
||||
|
||||
__fd_lock(fd);
|
||||
|
||||
if(mode < SEEK_SET || mode > SEEK_END)
|
||||
{
|
||||
SHOWMSG("seek mode is invalid");
|
||||
@@ -104,6 +108,10 @@ lseek(int file_descriptor, off_t offset, int mode)
|
||||
|
||||
out:
|
||||
|
||||
__fd_unlock(fd);
|
||||
|
||||
__stdio_unlock();
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user