elm config files - don't write to file if file handle is null 57/45757/3
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 17 Jun 2015 07:37:56 +0000 (16:37 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Tue, 11 Aug 2015 06:08:40 +0000 (23:08 -0700)
fixes seg with new file only config for elm

Change-Id: I5881db91cf4fcb49469b5b1ed3afb5105211ec0c
origin: upstream

src/lib/elm_config.c

index 2ba4dbf..2891658 100644 (file)
@@ -3326,9 +3326,13 @@ _elm_config_sub_init(void)
                           _elm_profile);
    if (!ecore_file_exists(buf))
      {
-        FILE *fp = fopen(buf, "w+");
-        fprintf(fp, "flush");
-        fclose(fp);
+        FILE *f = fopen(buf, "w+");
+
+        if (f)
+          {
+             fprintf(f, "flush");
+             fclose(f);
+          }
      }
    _eio_monitor = eio_monitor_add(buf);
    ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, _elm_config_file_monitor_cb, NULL);