[PATCH] -EINVAL if no fasync op for file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch proposes an additional error checking performed within setfl().

As a result, fcntl (fd, F_SETFL, O_ASYNC) will return -1 and set errno
to -EINVAL if filp->f_op->fasync is NULL for file specified by fd. This
is possible, for example, if fd is a descriptor returned by inotify_init().


Dmitry

Signed-off-by: Dmitry Antipov <[email protected]>

--- .orig-2.6.23/fs/fcntl.c	2007-10-17 15:26:06.000000000 +0400
+++ 2.6.23/fs/fcntl.c	2007-10-17 15:25:27.000000000 +0400
@@ -240,6 +240,9 @@
 			error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
 			if (error < 0)
 				goto out;
+		} else {
+			error = -EINVAL;
+			goto out;
 		}
 	}
 

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux