diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-26 19:01:25 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-26 19:01:25 +0100 |
commit | b9e65ec63d3020251d34ed79a4fb8868d8b7e2be (patch) | |
tree | 99d406d0fd6ce3befc9fb93dee4679f2fdb19de6 /src/plugins/scripts/python | |
parent | 24135801b49cda825146ea9e831f7927ff945dbe (diff) | |
download | weechat-b9e65ec63d3020251d34ed79a4fb8868d8b7e2be.zip |
Fix bug with writing of configuration files when disk is full (bug #29331)
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 8c98a99b4..dd7ec0f0a 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -1184,14 +1184,14 @@ weechat_python_api_config_read_cb (void *data, * weechat_python_api_config_section_write_cb: callback for writing section */ -void +int weechat_python_api_config_section_write_cb (void *data, struct t_config_file *config_file, const char *section_name) { struct t_script_callback *script_callback; char *python_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; @@ -1207,11 +1207,20 @@ weechat_python_api_config_section_write_cb (void *data, script_callback->function, python_argv); - if (rc) + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (python_argv[1]) free (python_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* @@ -1219,14 +1228,14 @@ weechat_python_api_config_section_write_cb (void *data, * default values for section */ -void +int weechat_python_api_config_section_write_default_cb (void *data, struct t_config_file *config_file, const char *section_name) { struct t_script_callback *script_callback; char *python_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; @@ -1242,11 +1251,20 @@ weechat_python_api_config_section_write_default_cb (void *data, script_callback->function, python_argv); - if (rc) + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (python_argv[1]) free (python_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* |