Re: [BUG 2.5.X] pipe/fcntl/F_GETFL/F_SETFL obvious kernel bug

From: Andrew Morton (akpm@digeo.com)
Date: Thu Apr 24 2003 - 16:23:06 EST


Jean Tourrilhes <jt@bougret.hpl.hp.com> wrote:
>
> Hi,
>
> I reported this obvious kernel 2.5.X bug 6 months ago, and as
> of 2.5.67 it is still not fixed. Do you know who I should send this
> bug report to ?

fcntl(fd, F_GETFL, intp) does not put the return value into *intp. The
flags are in fcntl()'s return value. Same with 2.4.

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

int main()
{
        int trigger_pipe[2];
        int err;
        int flags;
        int newflags;

        pipe(trigger_pipe);

        /* Get flags */
        flags = fcntl(trigger_pipe[0], F_GETFL, NULL);
        fprintf(stderr, "Set flags: 0x%x\n", flags);

        /* Set flags */
        flags |= O_NONBLOCK;
        err = fcntl(trigger_pipe[0], F_SETFL, flags);
        fprintf(stderr, "Set flags: %d\n", err);

        /* Check flags */
        flags = fcntl(trigger_pipe[0], F_GETFL, NULL);
        fprintf(stderr, "Get flags: 0x%0x\n", flags);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:18 EST