Opening /dev/stdout in Docker

Benjamin Thompson b.thompson at
Fri Aug 5 06:38:30 UTC 2022

Hi Alan

Many thanks for your quick reply.

> However this did not help so I looked at the source code and noticed that
> > FreeRADIUS is opening the file with read/write permissions whereas only
> > write is available:
> >
> >
> >
> > if (strncmp(filename, "/dev/", 5) == 0) {
> >         fd = open(filename, O_RDWR, permissions);
>   It's possible to add some checks there for permissions, and modify
> O_RDWR for that.  I've pushed a fix.
>   See commit 1abf810524 on GitHub.  You should be able to add that to
> 3.2.0 without any issues.

I tried the patch against 3.2.0 but it seems to be not detecting the
permissions correctly and is still trying to open the device as read/write.
I don't know why that is but I guess that it might be because it is not a
real file and/or is behind several symlinks.

Just as a test I added:

        if (strncmp(filename, "/dev/stdout", 11) == 0) {
            oflag = O_WRONLY;

This worked as expected.

Benjamin Thompson

More information about the Freeradius-Users mailing list