diff --git a/library/changes b/library/changes index 45bbbcd..7f57293 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,6 @@ +- fpathconf() should work with the stdio streams, even in the thread-safe + library version, again. + - Updated m68k specs file in /documentation to contain an own __CLIB2__ define so that existing m68k compilers also have this define. In addition, the common "-noixemul" option can now also be specified but will do a NOP diff --git a/library/unistd_fpathconf.c b/library/unistd_fpathconf.c index 64c25fd..e85f7b4 100644 --- a/library/unistd_fpathconf.c +++ b/library/unistd_fpathconf.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_fpathconf.c,v 1.2 2006-09-12 14:16:44 obarthel Exp $ + * $Id: unistd_fpathconf.c,v 1.3 2006-09-17 16:36:48 obarthel Exp $ * * :ts=4 * @@ -51,6 +51,8 @@ long fpathconf(int file_descriptor,int name) { struct FileHandle *fh; + BPTR default_file; + int error = 0; long ret = -1; struct fd *fd; @@ -59,22 +61,29 @@ fpathconf(int file_descriptor,int name) fd = __get_file_descriptor(file_descriptor); if(fd == NULL) { - __set_errno(EINVAL); + error = EINVAL; goto out; } - if(FLAG_IS_SET(fd->fd_Flags,FDF_STDIO) || FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) + if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) { - __set_errno(EBADF); + error = EBADF; goto out; } - fh = BADDR(fd->fd_DefaultFile); + error = __get_default_file(file_descriptor,&default_file); + if(error != 0) + goto out; - ret = __pathconf(fh->fh_Type,name); /* Ok if fh->fh_Type==NULL */ + fh = BADDR(default_file); + + ret = __pathconf(fh->fh_Type,name); out: + if(ret == -1 && error != 0) + __set_errno(error); + RETURN(ret); return(ret); }