Hi folks
Can deamonized process access to stderr, stdout?
I 'm trying to display error_num/return value of a function run() in stderr using
fprintf(stderr, "function run() returns = %d", ret_val);
run() is called after deamonizing the process.
Hi folks
Can deamonized process access to stderr, stdout?
I 'm trying to display error_num/return value of a function run() in stderr using
fprintf(stderr, "function run() returns = %d", ret_val);
run() is called after deamonizing the process.
Yes, they can. A background process inherits its parents file descriptors, but there's no guarantee on where they're pointing to, or even if they're open.
Generally it's a good idea for a daemon to close stdin/stdout/stderr, and print messages to a log (either via syslog() or directly)