Revision e9c60f20
Added by Renato Botelho almost 9 years ago
src/etc/inc/config.lib.inc | ||
---|---|---|
491 | 491 |
* RESULT |
492 | 492 |
* boolean - true if successful, false if not |
493 | 493 |
******/ |
494 |
function safe_write_file($file, $content, $force_binary) { |
|
494 |
function safe_write_file($file, $content, $force_binary = false) {
|
|
495 | 495 |
$tmp_file = $file . "." . getmypid(); |
496 | 496 |
$write_mode = $force_binary ? "wb" : "w"; |
497 | 497 |
|
... | ... | |
565 | 565 |
$xmlconfig = dump_xml_config($config, $g['xml_rootobj']); |
566 | 566 |
|
567 | 567 |
/* write new configuration */ |
568 |
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig, false)) {
|
|
568 |
if (!safe_write_file("{$g['cf_conf_path']}/config.xml", $xmlconfig)) { |
|
569 | 569 |
log_error(gettext("WARNING: Config contents could not be saved. Could not open file!")); |
570 | 570 |
unlock($lockkey); |
571 | 571 |
file_notice("config.xml", sprintf(gettext("Unable to open %s/config.xml for writing in write_config()%s"), $g['cf_conf_path'], "\n")); |
Also available in: Unified diff
Make $force_binary parameter optional, default to false