e2fsprogs
e2fsprogs copied to clipboard
fuse2fs incorrectly assigns to stdout/stderr
first added probably in 5cdebf3eebc22cb850e7ba0344379a4918ef4a1a
the code does the following:
/* Set up error logging */
logfile = getenv("FUSE2FS_LOGFILE");
if (logfile) {
FILE *fp = fopen(logfile, "a");
if (!fp) {
perror(logfile);
goto out;
}
stderr = fp;
stdout = fp;
} else if (fctx.kernel) {
/* in kernel mode, try to log errors to the kernel log */
FILE *fp = fopen("/dev/ttyprintk", "a");
if (fp) {
stderr = fp;
stdout = fp;
}
}
this is not standard c and is not required or expected to compile or work and will fail on anything that is not glibc (stdout/stderr can be a macro)
the standard way is to use freopen