I want to capture stdout of running process whose stdout is being redirected to /dev/null. I tried using system call fcntl(), however the moment I close fd 1, it was being allocated for other files as it was lowest available fd number. Any ideas how to lock given fd and reassign to other file?
How to capture stdout of a running process redirected to /dev/null
files;pipe