aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--main.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5238af7e..0c054d24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fix the inplace tests on *BSD systems.
+
+ * main.c (main): Add O_APPEND flag to fileno(stderr).
+
2018-01-17 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (do_isarray): Check that tmp is Node_var
diff --git a/main.c b/main.c
index 55983789..79782a81 100644
--- a/main.c
+++ b/main.c
@@ -246,6 +246,14 @@ main(int argc, char **argv)
if ((cp = getenv("GAWK_LOCALE_DIR")) != NULL)
locale_dir = cp;
+#if defined(F_GETFL) && defined(O_APPEND)
+ int flags = fcntl(fileno(stderr), F_GETFL, NULL);
+ if (flags >= 0 && (flags & O_APPEND) == 0) {
+ flags |= O_APPEND;
+ (void) fcntl(fileno(stderr), F_SETFL, flags);
+ }
+#endif
+
#if defined(LOCALEDEBUG)
initial_locale = locale;
#endif