int ret;
/*
+ * Early return if magic descriptor used by "at" family of syscalls.
+ */
+ if (fd == AT_FDCWD)
+ return (0);
+
+ /*
* Check that the file descriptor table is initialised for this
* entry:
*/
int ret;
/*
+ * Early return if magic descriptor used by "at" family of syscalls.
+ */
+ if (fd == AT_FDCWD)
+ return (0);
+
+ /*
* Check that the file descriptor table is initialised for this
* entry:
*/
int ret;
/*
+ * Early return if magic descriptor used by "at" family of syscalls.
+ */
+ if (fd == AT_FDCWD)
+ return (0);
+
+ /*
* Check that the file descriptor table is initialised for this
* entry:
*/
int ret;
/*
+ * Early return if magic descriptor used by "at" family of syscalls.
+ */
+ if (fd == AT_FDCWD)
+ return (0);
+
+ /*
* Check that the file descriptor table is initialised for this
* entry:
*/
{
/*
* Insure that the file descriptor table is initialized for this
- * entry:
+ * entry except if magic descriptor used by "at" family of syscalls.
*/
- return (_thread_fd_table_init(fd));
+ return ((fd != AT_FDCWD) ? _thread_fd_table_init(fd) : 0);
}
void
{
/*
* Insure that the file descriptor table is initialized for this
- * entry:
+ * entry except if magic descriptor used by "at" family of syscalls.
*/
- return (_thread_fd_table_init(fd));
+ return ((fd != AT_FDCWD) ? _thread_fd_table_init(fd) : 0);
}
void
int fd;
int mode = 0;
va_list ap;
+ int error;
+
+ if ((error = _FD_LOCK(fdbase, FD_READ, NULL)) != 0)
+ return (error);
/* Check if the file is being created: */
if (flags & O_CREAT) {
fd = -1;
}
+ _FD_UNLOCK(fdbase, FD_READ);
+
/* Return the file descriptor or -1 on error: */
return (fd);
}