b504e5
diff -urNp old/configure new/configure
b504e5
--- old/configure	2018-09-06 11:04:16.372792568 +0200
b504e5
+++ new/configure	2018-09-06 11:04:44.475765043 +0200
b504e5
@@ -25265,7 +25265,7 @@ fi
b504e5
 
b504e5
 
b504e5
 #  Agent:
b504e5
-for ac_func in cgetnext        chown          execv                           gai_strerror                   getgrnam                        gethostname     getloadavg                                     getpid          getpwnam                                       hasmntopt       initgroups                                     if_nameindex    if_indextoname if_nametoindex                  localtime_r     mkstemp        mktime                          poll            regcomp                                        setgid          setgroups                                      setmntent       setuid                                         sigaction       sigblock      sighold                          sigprocmask                                                    statfs          statvfs       stime                            strncasecmp     system                                         uname           usleep
b504e5
+for ac_func in cgetnext        chown          execv                           forkall       fsync     gai_strerror                   getgrnam                        gethostname     getloadavg                                     getpid          getpwnam                                       hasmntopt       initgroups                                     if_nameindex    if_indextoname if_nametoindex                  localtime_r     mkstemp        mktime                          poll            regcomp                                        setgid          setgroups                                      setmntent       setuid                                         sigaction       sigblock      sighold                          sigprocmask                                                    statfs          statvfs       stime                            strncasecmp     system                                         uname           usleep
b504e5
 do :
b504e5
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
b504e5
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
b504e5
diff -urNp old/configure.d/config_os_functions new/configure.d/config_os_functions
b504e5
--- old/configure.d/config_os_functions	2018-09-06 11:04:16.396792546 +0200
b504e5
+++ new/configure.d/config_os_functions	2018-09-06 11:04:44.508765009 +0200
b504e5
@@ -88,7 +88,8 @@ AC_REPLACE_FUNCS([getopt        inet_nto
b504e5
 
b504e5
 #  Agent:
b504e5
 AC_CHECK_FUNCS([cgetnext        chown          execv           ] dnl
b504e5
-               [gai_strerror                   getgrnam        ] dnl
b504e5
+               [forkall         fsync                          ] dnl
b504e5
+               [gai_strerror    getgrnam                       ] dnl
b504e5
                [gethostname     getloadavg                     ] dnl
b504e5
                [getpid          getpwnam                       ] dnl
b504e5
                [hasmntopt       initgroups                     ] dnl
b504e5
diff -urNp old/include/net-snmp/net-snmp-config.h.in new/include/net-snmp/net-snmp-config.h.in
b504e5
--- old/include/net-snmp/net-snmp-config.h.in	2018-09-06 11:04:16.370792571 +0200
b504e5
+++ new/include/net-snmp/net-snmp-config.h.in	2018-09-06 11:04:44.492765026 +0200
b504e5
@@ -176,6 +176,9 @@
b504e5
 /* Define to 1 if you have the <fstab.h> header file. */
b504e5
 #undef HAVE_FSTAB_H
b504e5
 
b504e5
+/* Define to 1 if you have the `fsync' function. */
b504e5
+#undef HAVE_FSYNC
b504e5
+
b504e5
 /* Define to 1 if you have the `funlockfile' function. */
b504e5
 #undef HAVE_FUNLOCKFILE
b504e5
 
b504e5
diff -urNp old/net-snmp-create-v3-user.in new/net-snmp-create-v3-user.in
b504e5
--- old/net-snmp-create-v3-user.in	2018-09-06 11:04:16.372792568 +0200
b504e5
+++ new/net-snmp-create-v3-user.in	2018-09-13 09:17:05.427712857 +0200
b504e5
@@ -148,3 +148,4 @@ if test ! -d $outfile ; then
b504e5
     touch $outfile
b504e5
 fi
b504e5
 echo $line >> $outfile
b504e5
+sync
b504e5
diff -urNp old/snmplib/read_config.c new/snmplib/read_config.c
b504e5
--- old/snmplib/read_config.c	2018-09-06 11:04:16.395792547 +0200
b504e5
+++ new/snmplib/read_config.c	2018-09-07 06:53:33.671501357 +0200
b504e5
@@ -1508,6 +1508,9 @@ read_config_store(const char *type, cons
b504e5
 #ifdef NETSNMP_PERSISTENT_MASK
b504e5
     mode_t          oldmask;
b504e5
 #endif
b504e5
+#if HAVE_FSYNC
b504e5
+    int fd;
b504e5
+#endif
b504e5
 
b504e5
     if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
b504e5
                                NETSNMP_DS_LIB_DONT_PERSIST_STATE)
b504e5
@@ -1538,6 +1541,11 @@ read_config_store(const char *type, cons
b504e5
         if (line[strlen(line)] != '\n')
b504e5
             fprintf(fout, "\n");
b504e5
         DEBUGMSGTL(("read_config:store", "storing: %s\n", line));
b504e5
+#if HAVE_FSYNC
b504e5
+        fd = fileno(fout);
b504e5
+        fflush(fout);
b504e5
+        fsync(fd);
b504e5
+#endif
b504e5
         fclose(fout);
b504e5
     } else {
b504e5
         if (strcmp(NETSNMP_APPLICATION_CONFIG_TYPE, type) != 0) {