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