fdt->fd[newfd] = file; 
rcu_assign_pointer(fdt->fd[newfd], file); 
asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd){	int err = -EBADF;	struct file * file, *tofree;	struct files_struct * files = current->files;	struct fdtable *fdt;	spin_lock(&files->file_lock);	if (!(file = fcheck(oldfd)))		goto out_unlock;	err = newfd;	if (newfd == oldfd)		goto out_unlock;	err = -EBADF;	if (newfd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)		goto out_unlock;	get_file(file);			/* We are now finished with oldfd */	err = expand_files(files, newfd);	if (err < 0)		goto out_fput;	/* To avoid races with open() and dup(), we will mark the fd as	 * in-use in the open-file bitmap throughout the entire dup2()	 * process.  This is quite safe: do_close() uses the fd array	 * entry, not the bitmap, to decide what work needs to be	 * done.  --sct */	/* Doesn't work. open() might be there first. --AV */	/* Yes. It's a race. In user space. Nothing sane to do */	err = -EBUSY;	fdt = files_fdtable(files);	tofree = fdt->fd[newfd];	if (!tofree && FD_ISSET(newfd, fdt->open_fds))		goto out_fput;	fdt->fd[newfd] = file;	FD_SET(newfd, fdt->open_fds);	FD_CLR(newfd, fdt->close_on_exec);	spin_unlock(&files->file_lock);	if (tofree)		filp_close(tofree, files);	err = newfd;out:	return err;out_unlock:	spin_unlock(&files->file_lock);	goto out;out_fput:	spin_unlock(&files->file_lock);	fput(file);	goto out;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ab2af1f5005069321c5d130f09cce577b03f43ef/fcntl.c/clean/fs/fcntl.c