summaryrefslogtreecommitdiffstats
path: root/src/main/exfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/exfile.c')
-rw-r--r--src/main/exfile.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/exfile.c b/src/main/exfile.c
index 59e6a05..1b498ce 100644
--- a/src/main/exfile.c
+++ b/src/main/exfile.c
@@ -170,7 +170,20 @@ static int exfile_open_mkdir(exfile_t *ef, char const *filename, mode_t permissi
oflag = O_RDWR;
}
- fd = open(filename, oflag, permissions);
+ /*
+ * Just dup stdout / stderr if it's possible.
+ */
+ if ((default_log.dst == L_DST_STDOUT) &&
+ (strcmp(filename, "/dev/stdout") == 0)) {
+ fd = dup(STDOUT_FILENO);
+
+ } else if ((default_log.dst == L_DST_STDERR) &&
+ (strcmp(filename, "/dev/stderr") == 0)) {
+ fd = dup(STDERR_FILENO);
+ } else {
+ fd = open(filename, oflag, permissions);
+ }
+
if (fd < 0) {
fr_strerror_printf("Failed to open file %s: %s",
filename, strerror(errno));