GNOME Bugzilla – Bug 771890
[review] write and load some device-state to /var/run [th/device-state-bgo771890]
Last modified: 2016-09-26 11:17:42 UTC
The actual state is still unused. This is in preparation for bug 746440 and will be used later. Please review.
> config: use logging macros - nm_log_dbg (LOGD_CORE, "don't persistate internal configuration (no file set, use --intern-config?)"); + _LOGD ("don't persistate internal configuration (no file set, use --intern-config?)"); s/persistate/persist/ > config: store and load device runtime state to file + const int EXTRA = 30; + char buf[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + EXTRA + 3] = NM_CONFIG_DEVICE_STATE_DIR"/"; nm-config.c: In function ‘nm_config_device_state_prune_unseen’: nm-config.c:2010:2: error: variable-sized object may not be initialized char buf[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + EXTRA + 3] = NM_CONFIG_DEVICE_STATE_DIR"/"; + if (!g_key_file_save_to_file (kf, path, &local)) { + _LOGT ("device-state: failure to write #%d (%s): %s", ifindex, path, local->message); A failure here will cause a wrong behavior when NM is restarted, so maybe we need at least _LOGI ? + device_state_data = &((char *) device_state)[sizeof (NMConfigDeviceStateData)]; device_state_date = (char *) (device_state + 1); ? The rest LGTM.
thanks. Fixed all and repushed
merged to master: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=5db62eb51d0664cc815e146dc49b82bbddae3ae1