Commit c163b1a4 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix potential crash in lp_config_sync.c

parent ac204a0f
......@@ -793,7 +793,6 @@ void lp_section_write(LpSection *sec,LpConfig *lpconfig){
}
int lp_config_sync(LpConfig *lpconfig){
int fd = -1;
bctbx_vfs_file_t *pFile = NULL;
if (lpconfig->filename==NULL) return -1;
if (lpconfig->readonly) return 0;
......@@ -804,8 +803,7 @@ int lp_config_sync(LpConfig *lpconfig){
#endif
pFile = bctbx_file_open(lpconfig->g_bctbx_vfs,lpconfig->tmpfilename, "w");
lpconfig->pFile = pFile;
fd = pFile->fd;
if (fd == -1 ){
if (pFile == NULL){
ms_warning("Could not write %s ! Maybe it is read-only. Configuration will not be saved.",lpconfig->filename);
lpconfig->readonly=1;
return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment