Skip to content

Do not hang on named pipe#607

Merged
cgzones merged 1 commit intologrotate:mainfrom
cgzones:fifo_hang
Jun 1, 2024
Merged

Do not hang on named pipe#607
cgzones merged 1 commit intologrotate:mainfrom
cgzones:fifo_hang

Conversation

@cgzones
Copy link
Member

@cgzones cgzones commented May 30, 2024

If a malicious application places a named pipe (FIFO) in a log directory do not hang while opening it.
Open the file in non blocking mode, and after checking it's a regular file drop the flag for portability.

Also specify the flag O_NOCTTY, since no log file should ever become the process's controlling terminal.

If a malicious application places a named pipe (FIFO) in a log directory
do not hang while opening it.
Open the file in non blocking mode, and after checking it's a regular
file drop the flag for portability.

Also specify the flag O_NOCTTY, since no log file should ever become the
process's controlling terminal.
EOF

grep "test_fifo.log.1 (read-only) for compression: Operation not supported" error.log >/dev/null
if [ $? != 0 ]; then

Check warning

Code scanning / shellcheck

Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.

Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.
@cgzones cgzones merged commit 4c0952f into logrotate:main Jun 1, 2024
@cgzones cgzones deleted the fifo_hang branch June 1, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant