Sigh. I meant the kernel behaviour is idiotic. Returning -EINVAL would
have been much better behaviour.
>
> > The Open Group go on to say "The result of using O_TRUNC with O_RDONLY is
> > undefined" which is also rather silly.
> >
> > I'd be inclined to leave it as-is, really.
>
> I hate to think how many programmers are relying on the *documented* behavior to
> prevent data loss during debugging/test runs....
We've lived with it for this long.
The behaviour is "undefined". Any application which uses O_RDONLY|O_TRUNC
is buggy.
If we were to alter the behaviour now, any buggy-but-happens-to-work app
which is accidentally using O_RDONLY|O_TRUNC may break. And now is not the
time to break things.
Given that the behaviour is undefined, the behaviour which we should
implement is clearly "whatever 2.4 is doing". So let's leave it alone.
-
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/