Add failure log for removing dump file 03/198103/4 accepted/tizen/unified/20190128.061542 submit/tizen/20190123.011901
authorSeokHoon LEE <andy.shlee@samsung.com>
Mon, 21 Jan 2019 01:37:10 +0000 (10:37 +0900)
committerSeokHoon LEE <andy.shlee@samsung.com>
Tue, 22 Jan 2019 01:04:16 +0000 (10:04 +0900)
- Add failure log
- change remove to g_remove

Change-Id: If0096f4656932af8c95a76e4262170590ed6c207
Signed-off-by: SeokHoon LEE <andy.shlee@samsung.com>
packaging/libmm-wfd.spec
src/mm_wfd_sink_ini.c
src/mm_wfd_sink_util.c

index 63250d5..0262a57 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-wfd
 Summary:    Multimedia Framework Wifi-Display Library
-Version:    0.2.240
+Version:    0.2.241
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 5261d70..89c3f7e 100644 (file)
@@ -576,7 +576,7 @@ mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini, const char *path)
 static
 void __mm_wfd_sink_ini_check_status(const char *path)
 {
-       struct stat ini_buff;
+       GStatBuf ini_buff;
 
        wfd_sink_return_if_fail(path);
 
@@ -587,7 +587,11 @@ void __mm_wfd_sink_ini_check_status(const char *path)
        } else {
                if (ini_buff.st_size < 5) {
                        wfd_sink_error("%s file size=%d, Corrupted! So, Removed", path, (int)ini_buff.st_size);
-                       g_remove(path);
+                       if (g_remove(path) == -1) {
+                               char buf[255] = {0, };
+                               strerror_r(errno, buf, sizeof(buf));
+                               wfd_sink_error("failed to delete corrupted ini [%s]", buf);
+                       }
                }
        }
 
index 665ce57..2c4feb5 100644 (file)
@@ -20,6 +20,8 @@
  *
  */
 
+#include <glib.h>
+#include <glib/gstdio.h>
 #include <stdio.h>
 #include "mm_wfd_sink_util.h"
 #include <tzplatform_config.h>
@@ -170,6 +172,7 @@ void
 mm_wfd_sink_util_add_pad_probe_for_data_dump(GstElement *element, const gchar *pad_name)
 {
        GstPad *probe_pad = NULL;
+       char buf[256] = {0, };
 
        if (element && pad_name)
                probe_pad = gst_element_get_static_pad(element, pad_name);
@@ -181,7 +184,10 @@ mm_wfd_sink_util_add_pad_probe_for_data_dump(GstElement *element, const gchar *p
                elementname = gst_element_get_name(element);
                snprintf(file_path, sizeof(file_path), TS_DUMP_FILE_FORMAT, DUMP_TS_DATA_PATH, elementname, pad_name);
                MMWFDSINK_FREEIF(elementname);
-               remove(file_path);
+               if (g_remove(file_path) == -1) {
+                       strerror_r(errno, buf, sizeof(buf));
+                       wfd_sink_error("Failed to delete old dump file. [%s]", buf);
+               }
 
                wfd_sink_debug("add pad(%s) probe", GST_STR_NULL(GST_PAD_NAME(probe_pad)));
                gst_pad_add_probe(probe_pad, GST_PAD_PROBE_TYPE_BUFFER, _mm_wfd_sink_util_dump, (gpointer)NULL, NULL);