lkml.org 
[lkml]   [2007]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] -EINVAL if no fasync op for file
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 <antipov@dev.rtsoft.ru>

--- .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;
}
}
\
 
 \ /
  Last update: 2007-10-18 11:53    [from the cache]
©2003-2011 Jasper Spaans